题解 | #还是A+B#
还是A+B
https://www.nowcoder.com/practice/8c3c5dae2c4a4266ba04f993a18e286b
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
// TODO 自动生成的方法存根
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 x = 1;
while (k > 0) {
x = x * 10;
k--;
}
if (a % x == b % x) {
System.out.println("-1");
} else
System.out.println(a + b);
}
}
}
海康威视公司氛围 989人发布