結果

問題 No.339 何人が回答したのか
ユーザー samplelpmas
提出日時 2017-04-21 16:01:13
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 1,000 ms
コード長 525 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 74,316 KB
実行使用メモリ 41,516 KB
最終ジャッジ日時 2024-07-20 05:03:21
合計ジャッジ時間 12,822 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int gcd = 100;

        for (int i = 0; i < n; i++) {

            gcd = gcd(gcd, sc.nextInt());

        }

        System.out.println(100 / gcd);

    }

    private static int gcd(int a, int b) {

        while (b > 0) {

            int remainder = a % b;
            a = b;
            b = remainder;

        }

        return a;

    }

}
0