算法竞赛中经常有多组数据输入,以EOF结束的题目, 在c语言中使用很方便:
- while (scanf("%d",&m)!=EOF)
- { ...
- }
-
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
....
}
算法竞赛中经常有多组数据输入,以EOF结束的题目, 在c语言中使用很方便:
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
....
}