結果

問題 No.339 何人が回答したのか
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-04 06:13:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 737 bytes
コンパイル時間 3,803 ms
コンパイル使用メモリ 75,812 KB
実行使用メモリ 41,828 KB
最終ジャッジ日時 2024-04-17 00:15:44
合計ジャッジ時間 13,910 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
41,676 KB
testcase_01 AC 141 ms
41,536 KB
testcase_02 AC 137 ms
41,816 KB
testcase_03 AC 137 ms
41,596 KB
testcase_04 AC 136 ms
41,464 KB
testcase_05 AC 136 ms
41,596 KB
testcase_06 AC 134 ms
41,264 KB
testcase_07 AC 135 ms
41,456 KB
testcase_08 AC 134 ms
41,684 KB
testcase_09 AC 138 ms
41,716 KB
testcase_10 AC 138 ms
41,808 KB
testcase_11 AC 137 ms
41,592 KB
testcase_12 AC 138 ms
41,824 KB
testcase_13 AC 136 ms
41,680 KB
testcase_14 AC 135 ms
41,264 KB
testcase_15 AC 141 ms
41,504 KB
testcase_16 AC 139 ms
41,300 KB
testcase_17 AC 140 ms
41,512 KB
testcase_18 AC 138 ms
41,292 KB
testcase_19 AC 136 ms
41,476 KB
testcase_20 AC 137 ms
41,440 KB
testcase_21 AC 135 ms
41,316 KB
testcase_22 AC 140 ms
41,248 KB
testcase_23 AC 138 ms
41,800 KB
testcase_24 AC 140 ms
41,496 KB
testcase_25 AC 135 ms
41,268 KB
testcase_26 AC 137 ms
41,504 KB
testcase_27 AC 136 ms
41,164 KB
testcase_28 AC 137 ms
41,376 KB
testcase_29 AC 136 ms
41,692 KB
testcase_30 AC 136 ms
41,608 KB
testcase_31 AC 136 ms
41,436 KB
testcase_32 AC 134 ms
41,540 KB
testcase_33 AC 136 ms
41,512 KB
testcase_34 AC 136 ms
41,728 KB
testcase_35 AC 137 ms
41,612 KB
testcase_36 AC 138 ms
41,808 KB
testcase_37 AC 136 ms
41,640 KB
testcase_38 AC 135 ms
41,488 KB
testcase_39 AC 136 ms
41,684 KB
testcase_40 AC 132 ms
41,268 KB
testcase_41 AC 135 ms
41,272 KB
testcase_42 AC 137 ms
41,116 KB
testcase_43 AC 136 ms
41,528 KB
testcase_44 AC 135 ms
41,468 KB
testcase_45 AC 137 ms
41,464 KB
testcase_46 AC 135 ms
41,404 KB
testcase_47 AC 135 ms
41,828 KB
testcase_48 AC 136 ms
41,572 KB
testcase_49 AC 137 ms
41,420 KB
testcase_50 AC 135 ms
41,824 KB
testcase_51 AC 135 ms
41,420 KB
testcase_52 AC 135 ms
41,708 KB
testcase_53 AC 134 ms
41,704 KB
testcase_54 AC 139 ms
41,488 KB
testcase_55 AC 135 ms
41,752 KB
testcase_56 AC 136 ms
41,684 KB
testcase_57 AC 137 ms
41,424 KB
testcase_58 AC 136 ms
41,416 KB
testcase_59 AC 134 ms
41,548 KB
testcase_60 AC 135 ms
41,532 KB
testcase_61 AC 136 ms
41,596 KB
testcase_62 AC 134 ms
41,288 KB
testcase_63 AC 132 ms
41,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise57{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    int[] percentages = new int[n];

    for (int i = 0; i < n; i++){
      percentages[i] = sc.nextInt();
    }

    Arrays.sort(percentages);

    int gcm = 0;
    if (n < 2){
      gcm = 100;
    }else{
      gcm = ea(percentages[1], percentages[0]);
      for(int i = 2; i < n; i++){
        gcm = ea(percentages[i], gcm);
      }
    }

    System.out.println(100 / gcm);
  }
  private static int ea (int biggerNum, int smallerNum){
    int mod = biggerNum % smallerNum;
    if (mod == 0){
      return smallerNum;
    } else {
      return ea(smallerNum, mod);
    }
  }
}
0