Tanky WooRSS

HDOJ 1229 还是A+B

16 Aug 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

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


还是水题~~~

// Author: Tanky woo
// HDOJ 1229
#include 
using namespace std;

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