public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Please give the number of banks and the limit");
int N=sc.nextInt();
int limit=sc.nextInt();
double[][] borrowers=new double[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
borrowers[i][j]=0;
}
}
float[] Sum=new float[N];
for (int i = 0; i < N; i++) {
borrowers[i][i]=sc.nextDouble();
for (int j = 0; j < sc.nextInt(); j++) {
Sum[i] += (borrowers[i][sc.nextInt()]=sc.nextDouble());
System.out.println(Sum[i]);
}
}
}
输入的是
5 201
25 2 1 100.5 4 320.5
然后结果显示
Exception in thread "main" java.util.InputMismatchException
at java.base/java.util.Scanner.throwFor(Scanner.java:939)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Exercise8.C8p17.main(C8p17.java:22)
各位能讲一下是哪里出了问题吗?