HDU3953 I & #39; ll play a trick on you
In the analysis, it is easy to mistakenly think that the sample is the difference between A and B, but it is found that the last number in the figure is "7", which does not conform to this rule, then observe the graph and we can find the following rule:
99 72 "=>" 9 + 9 = 18, 7 + 2 = 9 18 + 9 = 27;
45 27 "=>" 4 + 5 = 9, 2 + 7 = 9 9 + 9 = 18;
39 18 "=>" 3 + 9 = 12, 1 + 8 = 9, 12 + 9 = 21;
36 21 "=>" 3 + 6 = 9, 2 + 1 = 3, 9 + 3 = 12;
28 12 "=>" 2 + 8 = 10, 1 + 2 = 3, 10 + 3 = 13;
21 13 "=>" 2 + 1 = 3, 1 + 3 = 4, 3 + 4 = 7;
# Include
# Include
Int main ()
{
Int n, I, sum, k, t;
Char a [1, 101], B [2, 101];
Scanf ("% d \ n", & n );
While (n --)
{
Sum = 0;
Scanf ("% s", a, B );
K = strlen ();
T = strlen (B );
For (I = 0; I Sum + = a [I]-'0 ';
For (I = 0; I Sum + = B [I]-'0 ';
Printf ("% d \ n", sum );
}
Return 0;
}
String processing, as long as each number is added up, and the result is: 99 729 + 9 + 7 + 2 = 27
# Include
Int main ()
{
Int n, c, I;
For (scanf ("% d \ n", & n); n --; printf ("% d \ n", I ))
For (I = 0; (c = getchar ())! = '\ N'; I + = (c-32? C-'0': 0 ));
Return 0;
}