結果

問題 No.339 何人が回答したのか
ユーザー tentententen
提出日時 2020-10-05 03:13:31
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 414 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 74,332 KB
実行使用メモリ 41,496 KB
最終ジャッジ日時 2024-07-19 19:00:07
合計ジャッジ時間 10,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
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 gcd = 100;
		for (int i = 0; i < n; i++) {
		    gcd = getGCD(gcd, sc.nextInt());
		}
		System.out.println(100 / gcd);
	}
	
	static int getGCD(int x, int y) {
	    if (x % y == 0) {
	        return y;
	    } else {
	        return getGCD(y, x % y);
	    }
	}
}
0