import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.print(gongyue(a, b));
}
static int gongyue(int n, int m) {
if (m <= n)
if (n % m == 0)
return (m);
else
return gongyue(m, n % m);
else
return gongyue(m, n);
}
}
运行错误如下:
Exception in thread "main" java.util.InputMismatchException: For input string: "123456789101112"
at java.util.Scanner.nextInt(Scanner.java:2166)
at java.util.Scanner.nextInt(Scanner.java:2119)
at Main.main(Main.java:8)
求改求解析!
相关分类