import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int a = sc.nextInt();
int b = sc.nextInt();
int k = sc.nextInt();
if (a==0&&b==0) {
break;
}
int ta = a;
int tb = b;
boolean yes = true;
while (k-->0) {
if (ta%10 != tb%10) {
yes = false;
break;
}
ta /= 10;
tb /= 10;
}
if (yes) {
System.out.println(-1);
}else {
System.out.println(a+b);
}
}
sc.close();
}
}
HDOJ 1229 还是A+B(水题)
最新推荐文章于 2018-03-05 12:50:47 发布