結果

問題 No.339 何人が回答したのか
ユーザー kohaku_kohaku
提出日時 2016-11-16 21:20:57
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 646 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 74,160 KB
実行使用メモリ 54,356 KB
最終ジャッジ日時 2024-11-26 02:28:09
合計ジャッジ時間 11,064 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N =sc.nextInt();
        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;
    }
}
0