因此,此代码在我的系统中可以正常工作,但在Codechef中出现此错误:
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Codechef.main(Main.java:14)
代码:
import java.util.Scanner;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scan = new Scanner(System.in);
int a,b,c;
int T = scan.nextInt();
int arr[] = new int[T];
for(int i=0;i<T;i++){
if(scan.hasNextInt()){
a = scan.nextInt();
b = scan.nextInt();
c = scan.nextInt();
if(a>=1 && b>=1 && c>=1 && a<180 && b<180 && c<180 && a+b+c == 180){
arr[i]=1;
}
}
}
for(int i=0;i<T;i++){
if(arr[i]==1)
System.out.println("YES");
else
System.out.println("NO");
}
scan.close();
}
}