結果

問題 No.736 約比
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-18 22:25:17
言語 Java19
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 2,482 ms
コンパイル使用メモリ 74,180 KB
実行使用メモリ 58,188 KB
最終ジャッジ日時 2023-07-24 19:15:57
合計ジャッジ時間 14,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
56,488 KB
testcase_01 AC 150 ms
56,456 KB
testcase_02 AC 145 ms
55,860 KB
testcase_03 AC 158 ms
56,160 KB
testcase_04 AC 160 ms
56,080 KB
testcase_05 AC 144 ms
56,164 KB
testcase_06 AC 141 ms
56,136 KB
testcase_07 AC 162 ms
55,832 KB
testcase_08 AC 159 ms
56,300 KB
testcase_09 AC 154 ms
55,940 KB
testcase_10 AC 161 ms
56,260 KB
testcase_11 AC 161 ms
56,556 KB
testcase_12 AC 161 ms
55,964 KB
testcase_13 AC 160 ms
56,040 KB
testcase_14 AC 149 ms
55,628 KB
testcase_15 AC 160 ms
56,312 KB
testcase_16 AC 149 ms
56,188 KB
testcase_17 AC 163 ms
55,940 KB
testcase_18 AC 164 ms
55,592 KB
testcase_19 AC 158 ms
56,736 KB
testcase_20 AC 160 ms
56,268 KB
testcase_21 AC 157 ms
55,752 KB
testcase_22 AC 142 ms
55,632 KB
testcase_23 AC 143 ms
55,776 KB
testcase_24 AC 163 ms
55,784 KB
testcase_25 AC 144 ms
55,816 KB
testcase_26 AC 143 ms
55,996 KB
testcase_27 AC 162 ms
58,140 KB
testcase_28 AC 162 ms
56,012 KB
testcase_29 AC 142 ms
55,596 KB
testcase_30 AC 162 ms
55,768 KB
testcase_31 AC 141 ms
55,892 KB
testcase_32 AC 143 ms
56,172 KB
testcase_33 AC 160 ms
56,012 KB
testcase_34 AC 142 ms
55,760 KB
testcase_35 AC 143 ms
56,008 KB
testcase_36 AC 161 ms
55,776 KB
testcase_37 AC 162 ms
56,112 KB
testcase_38 AC 162 ms
55,768 KB
testcase_39 AC 141 ms
56,612 KB
testcase_40 AC 160 ms
55,580 KB
testcase_41 AC 159 ms
54,248 KB
testcase_42 AC 156 ms
56,304 KB
testcase_43 AC 160 ms
56,312 KB
testcase_44 AC 157 ms
55,924 KB
testcase_45 AC 159 ms
55,668 KB
testcase_46 AC 143 ms
56,112 KB
testcase_47 AC 164 ms
56,020 KB
testcase_48 AC 155 ms
56,388 KB
testcase_49 AC 145 ms
55,984 KB
testcase_50 AC 146 ms
55,780 KB
testcase_51 AC 148 ms
54,268 KB
testcase_52 AC 162 ms
55,724 KB
testcase_53 AC 157 ms
56,136 KB
testcase_54 AC 153 ms
55,996 KB
testcase_55 AC 149 ms
55,916 KB
testcase_56 AC 152 ms
55,848 KB
testcase_57 AC 144 ms
56,188 KB
testcase_58 AC 161 ms
53,932 KB
testcase_59 AC 164 ms
58,188 KB
testcase_60 AC 147 ms
56,152 KB
testcase_61 AC 159 ms
55,944 KB
testcase_62 AC 140 ms
56,240 KB
testcase_63 AC 141 ms
55,768 KB
testcase_64 AC 141 ms
55,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] A = new long[n];
    A[0] = sc.nextLong();
    long ans = A[0];
    for(int i = 1; i < n; i++) {
      A[i] = sc.nextLong();
      ans = gcd(ans, A[i]);
    }
    for(int i = 0; i < n; i++) {
      if(i < n - 1) {
        System.out.print(A[i] / ans + ":");
      } else {
        System.out.print(A[i] / ans);
      }
    }
  }

  public static long gcd(long a, long b) {
    if(b == 0) return a;
    return gcd(b, (a % b));
  }
}
0