import java.util.*;
public class test {
public static void main(String args[]) {
int sum = 0;
Random r = new Random();
Scanner in = new Scanner(System.in);
long time = System.currentTimeMillis();
for (int i=0;i<10;i++) {
int a = r.nextInt(15)+1;
int b = r.nextInt(15)+1;
System.out.print("第" + (i + 1) + "道:" + a + " + " + b + " = ");
int c = in.nextInt();
if (a + b == c) {
sum++;
}
}
time = System.currentTimeMillis() - time;
System.out.println("答对了:" + sum + "道题,花费了"+ time + "毫秒");
}
}
第1道:10 + 6 = 16
第2道:6 + 13 = 19
第3道:2 + 7 = 9
第4道:7 + 3 = 10
第5道:2 + 15 = 17
第6道:2 + 15 = 17
第7道:6 + 14 = 0
第8道:14 + 6 = 0
第9道:12 + 15 = 0
第10道:13 + 6 = 0
答对了:6道题,花费了11802毫秒
取消
评论