题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1229

解题报告:A+B

 1 #include<cstdio>
 2 
 3 int main()
 4 {
 5     int a,b,k;
 6     while(scanf("%d%d%d",&a,&b,&k) && !(a == b && a == 0))
 7     {
 8         int sum = a + b;
 9         while(a % 10 == b % 10 && k)
10         {
11             k--;
12             a /= 10;
13             b /= 10;
14         }
15         printf(k <= 0? "-1\n":"%d\n",sum);
16     }
17     return 0;
18 }
View Code

相关文章:

  • 2022-12-23
  • 2021-04-15
  • 2021-05-17
  • 2021-10-07
  • 2021-08-01
  • 2021-08-03
  • 2021-09-01
  • 2021-11-07
猜你喜欢
  • 2021-08-28
  • 2021-07-05
  • 2022-12-23
  • 2022-01-03
  • 2021-12-30
  • 2022-12-23
  • 2021-07-19
相关资源
相似解决方案