import java.util.Scanner;
public class Main { /**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int tmp, n;
while(in.hasNextInt()){
n = in.nextInt();
boolean a[] = new boolean[1000002];
for(int i=0;i<n;++i){
tmp = in.nextInt();
if(a[tmp]){
System.out.println(tmp);
}else
a[tmp] = true;
}
}
}}
http://acm.fzu.edu.cn/problem.php?pid=1001题目,这样写会TLE,貌似是没提供输入了程序还在等,求解
这个就是输入啊
n = in.nextInt();
这个就是输入,在程序运行的时候你要在控制台输出的
然后你的2个循环都没有正常的推出,都是需要你输入一些错误的东西,通过异常才能退出
但是不知道你为什么会有tle
但是你的这个问题与题目无关
因为当代码走到n = in.nextInt();这一行时就是输入。n是用来接收值,而in.nextInt();就是指用户输入的值所以当代码运行时就会没有任何提示而要求输入的。而TLE是因为长时间没有输入值