2013
12-29

# Can you find it?

Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X.

There are many cases. Every data case is described as followed: In the first line there are three integers L, N, M, in the second line there are L integers represent the sequence A, in the third line there are N integers represent the sequences B, in the forth line there are M integers represent the sequence C. In the fifth line there is an integer S represents there are S integers X to be calculated. 1<=L, N, M<=500, 1<=S<=1000. all the integers are 32-integers.

There are many cases. Every data case is described as followed: In the first line there are three integers L, N, M, in the second line there are L integers represent the sequence A, in the third line there are N integers represent the sequences B, in the forth line there are M integers represent the sequence C. In the fifth line there is an integer S represents there are S integers X to be calculated. 1<=L, N, M<=500, 1<=S<=1000. all the integers are 32-integers.

3 3 3
1 2 3
1 2 3
1 2 3
3
1
4
10

Case 1:
NO
YES
NO

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
using namespace std;
int a[505],b[505],c[505];
int sum[505*505];
int l,n,m,k;
int flag;
void binary(int x)
{
int left,right,mid;
left=0,right=k-1;
while(left<=right)
{
mid=(left+right)>>1;
if(sum[mid]>x)
right=mid-1;
else if(sum[mid]<x)
left=mid+1;
else
{flag=1;return ;}
}
return ;
}

int main()
{
int i,j,q,x,cnt=1;
while(cin>>l>>n>>m)
{
for(i=0;i<l;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
scanf("%d",&b[i]);
for(i=0;i<m;i++)
scanf("%d",&c[i]);
k=0;
for(i=0;i<l;i++)
for(j=0;j<n;j++)
{
sum[k++]=a[i]+b[j];
}
sort(sum,sum+k);
scanf("%d",&q);
printf("Case %d:\n",cnt++);
while(q--)
{
scanf("%d",&x);
flag=0;
for(i=0;i<m;i++)
{
binary(x-c[i]);
if(flag){
printf("YES\n");
break;
}
}
if(!flag)
printf("NO\n");
}
}
return 0;
}

1. 我按安装这个最新版的插件之后,安装完成,启动,整个插件页面变成了空白页,也没提示什么,一片白,想问问你这是什么问题,我安装的wp是最新的中文版,3.0.5版的,谢谢!

2. I like your publish. It is great to see you verbalize from the coronary heart and clarity on this essential subject matter can be easily noticed.

3. simple, however efficient. A lot of instances it is difficult to get that a??perfect balancea?? among usability and appearance. I must say that youa??ve done a exceptional task with this. Also, the blog masses quite fast for me on Web explore.

4. for(int i=1; i<=m; i++){
for(int j=1; j<=n; j++){
dp = dp [j-1] + 1;
if(s1.charAt(i-1) == s3.charAt(i+j-1))
dp = dp[i-1] + 1;
if(s2.charAt(j-1) == s3.charAt(i+j-1))
dp = Math.max(dp [j - 1] + 1, dp );
}
}
这里的代码似乎有点问题？ dp(i)(j) = dp(i)(j-1) + 1;这个例子System.out.println(ils.isInterleave("aa","dbbca", "aadbbcb"));返回的应该是false

5. a是根先忽略掉，递归子树。剩下前缀bejkcfghid和后缀jkebfghicd，分拆的原则的是每个子树前缀和后缀的节点个数是一样的，根节点出现在前缀的第一个，后缀的最后一个。根节点b出现后缀的第四个位置，则第一部分为四个节点，前缀bejk，后缀jkeb，剩下的c出现在后缀的倒数第2个，就划分为cfghi和 fghic，第3部分就为c、c