2015
04-14

I’ll play a trick on you

Please look the picture carefully. Then I’ll give you two integers and your task is output the third one.

The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case.
Each case contains two integers A,B (1<=B<=A<=10100)

The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case.
Each case contains two integers A,B (1<=B<=A<=10100)

3
99 72
45 27
39 18

Case 1: 27
Case 2: 18
Case 3: 21
Hint
If you have any idea to work out the ? and explain why but couldn't get Accepted , please email me (notonlysuccess@gmail.com), the first person will get 100RMB from me.


#include<iostream>
#include<string>
using namespace std;
char a[105], b[105];

int main()
{
int T, t = 1;
scanf("%d", &T);
getchar();
while(T--)
{
int sum = 0, i;
scanf("%s %s", a, b);
for( i=0; a[i] != '\0'; i++ )
sum += a[i] - '0';
for( i=0; b[i] != '\0'; i++ )
sum += b[i] - '0';
printf("Case %d: %d\n", t++, sum);
}
return 0;
}

1. 有一点问题。。后面动态规划的程序中
int dp[n+1][W+1];
会报错 提示表达式必须含有常量值。该怎么修改呢。。

2. 我还有个问题想请教一下，就是感觉对于新手来说，递归理解起来有些困难，不知有没有什么好的方法或者什么好的建议？