[恢]hdu 1229

2011-12-16 00:08:13

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1229

题意:中文。。。

代码:

# include <stdio.h>


int test(int a, int b, int k)
{
while (k--)
{
if (a%10 != b%10) return 0 ;
a /= 10 ;
b /= 10 ;
}
return 1 ;
}


int main ()
{
int a, b, k ;
while (~scanf ("%d%d%d", &a, &b, &k) &&(a||b))
{
if(test(a,b,k)) puts ("-1") ;
else printf ("%d\n", a+b) ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314815.html