結果
| 問題 |
No.339 何人が回答したのか
|
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2016-11-16 21:22:57 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 733 bytes |
| コンパイル時間 | 2,263 ms |
| コンパイル使用メモリ | 74,348 KB |
| 実行使用メモリ | 56,092 KB |
| 最終ジャッジ日時 | 2024-11-26 02:28:46 |
| 合計ジャッジ時間 | 12,619 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 61 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
if(N==1){
System.out.println(100);
return;
}
int [] A = new int [N];
for(int i=0; i<N; i++){
A[i]=sc.nextInt();
}
int x = gcd(A[0],A[1]);
for(int i=2; i<N; i++){
x = gcd(x,A[i]);
if(x==1){break;}
}
System.out.println(100/x);
}
static int gcd(int a, int b){
while(true){
int t = a%b;
a=b;
b=t;
if(t==0){
break;
}
}
return a;
}
}
kohaku_kohaku