I'll play a trick on you
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2578 Accepted Submission(s): 731
Problem Description
Please look the picture carefully. Then I'll give you two integers and your task is output the third one.
Please never doubt the picture.
Please never doubt the picture.
![](https://i-blog.csdnimg.cn/blog_migrate/512f9c935ea6427ca519b7ed58f7aeb0.jpeg)
Input
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)
Each case contains two integers A,B (1<=B<=A<=10100)
Output
For each case, output the number of case and the third integer.(as shown in the sample output)
Sample Input
3 99 72 45 27 39 18
Sample Output
Case 1: 27 Case 2: 18 Case 3: 21HintIf 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.
Author
NotOnlySuccess
这种题,各种yy。一开始估计很多人都想到“?”是15,即两数相减,但是这样最后应该是8而不是7 。所以果断是错误的yy。
我也经历了各种错误的yy,真是惭愧,最后还是去google了一下,找到这个看起来比较靠谱的yy,而这个也刚好是题目正确的yy:
99 = 9 + 9 = 18,72 = 7 + 2 = 9,18 + 9 = 27;
45 = 4 + 5 = 9, 27 = 2 + 7 = 9,9 + 9 = 18;
39 = 3 + 9 = 12,18 = 1 + 8 = 9,12 + 9 = 21;
。。。。。。。
这样,最后的7也可以解释了:21 = 2 + 1 = 3,13 = 1 + 3 = 4,3 + 4 = 7
所以,“?”应该是12
代码:
这种题,各种yy。一开始估计很多人都想到“?”是15,即两数相减,但是这样最后应该是8而不是7 。所以果断是错误的yy。
我也经历了各种错误的yy,真是惭愧,最后还是去google了一下,找到这个看起来比较靠谱的yy,而这个也刚好是题目正确的yy:
99 = 9 + 9 = 18,72 = 7 + 2 = 9,18 + 9 = 27;
45 = 4 + 5 = 9, 27 = 2 + 7 = 9,9 + 9 = 18;
39 = 3 + 9 = 12,18 = 1 + 8 = 9,12 + 9 = 21;
。。。。。。。
这样,最后的7也可以解释了:21 = 2 + 1 = 3,13 = 1 + 3 = 4,3 + 4 = 7
所以,“?”应该是12
代码:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
string sa, sb;
cin >> t;
for (int k = 1; k <= t; k++)
{
cin >> sa >> sb;
int a = 0, b = 0;
for (int i = 0; i < sa.size(); i++)
a += sa[i] - '0';
for (int i = 0; i < sb.size(); i++)
b += sb[i] - '0';
cout << "Case " << k << ": " << a+b << endl;
}
}