import java.util.Scanner;
public class c202 {
public static void main(String[] args){
Scanner kin = new Scanner(System.in);
while(kin.hasNext()){
int n = kin.nextInt();
long p[] = new long[n];
c202 s1 = new c202();
int i=0;
while(i<n){
p[i] = kin.nextLong();
i++;
}
s1.Sorting(p);
System.out.println(s1.GCD(p));
}
}
public void Sorting(long k[]){
int j = k.length-1;
while(j>0){
long a;
int i=0;
while(i<j){
if(k[i]>k[j]){
a=k[i];
k[i]=k[j];
k[j]=a;
}
i++;
}
j--;
}
}
public long GCD(long p[]){
c202 s2 = new c202();
long r[] = new long[p.length-1];
for(int i=0;i<p.length-1;i++){
s2.ComputeGCD(p,r,i);
}
s2.Sorting(r);
return r[0];
}
public void ComputeGCD(long p[],long r[],int i){
long test = p[p.length-1-i];
long min = p[0];
long c = test%min;
while(c!=0){
test=min;
min=c;
c=test%min;
}
r[i]=min;
}
}
您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.util.InputMismatchException: For input string: "596469258000" at java.util.Scanner.nextInt(Scanner.java:2123) at java.util.Scanner.nextInt(Scanner.java:2076) at c202.main(c202.java:11)
您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.util.InputMismatchException: For input string: "202438051200" at java.util.Scanner.nextInt(Scanner.java:2123) at java.util.Scanner.nextInt(Scanner.java:2076) at c202.main(c202.java:11)
您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.util.InputMismatchException: For input string: "781130329980" at java.util.Scanner.nextInt(Scanner.java:2123) at java.util.Scanner.nextInt(Scanner.java:2076) at c202.main(c202.java:11)
您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.util.InputMismatchException: For input string: "704745514147" at java.util.Scanner.nextInt(Scanner.java:2123) at java.util.Scanner.nextInt(Scanner.java:2076) at c202.main(c202.java:11)
輸入範圍
int存不下