結果

問題 No.736 約比
ユーザー takeya_okinotakeya_okino
提出日時 2019-08-18 22:25:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 77,056 KB
実行使用メモリ 54,744 KB
最終ジャッジ日時 2024-04-09 02:45:04
合計ジャッジ時間 14,433 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
54,356 KB
testcase_01 AC 156 ms
54,308 KB
testcase_02 AC 154 ms
54,548 KB
testcase_03 AC 161 ms
54,412 KB
testcase_04 AC 164 ms
54,628 KB
testcase_05 AC 149 ms
53,984 KB
testcase_06 AC 147 ms
54,240 KB
testcase_07 AC 170 ms
54,440 KB
testcase_08 AC 171 ms
54,576 KB
testcase_09 AC 169 ms
54,392 KB
testcase_10 AC 173 ms
54,452 KB
testcase_11 AC 176 ms
54,412 KB
testcase_12 AC 173 ms
54,464 KB
testcase_13 AC 173 ms
54,444 KB
testcase_14 AC 158 ms
54,308 KB
testcase_15 AC 168 ms
54,488 KB
testcase_16 AC 156 ms
54,556 KB
testcase_17 AC 166 ms
54,260 KB
testcase_18 AC 165 ms
54,324 KB
testcase_19 AC 164 ms
54,476 KB
testcase_20 AC 167 ms
54,672 KB
testcase_21 AC 165 ms
54,352 KB
testcase_22 AC 146 ms
54,472 KB
testcase_23 AC 146 ms
54,212 KB
testcase_24 AC 168 ms
54,304 KB
testcase_25 AC 146 ms
54,232 KB
testcase_26 AC 146 ms
54,292 KB
testcase_27 AC 169 ms
54,648 KB
testcase_28 AC 168 ms
54,484 KB
testcase_29 AC 146 ms
54,320 KB
testcase_30 AC 170 ms
54,412 KB
testcase_31 AC 149 ms
54,136 KB
testcase_32 AC 146 ms
54,184 KB
testcase_33 AC 168 ms
54,404 KB
testcase_34 AC 147 ms
54,208 KB
testcase_35 AC 149 ms
54,132 KB
testcase_36 AC 169 ms
54,280 KB
testcase_37 AC 167 ms
54,436 KB
testcase_38 AC 168 ms
54,372 KB
testcase_39 AC 149 ms
54,268 KB
testcase_40 AC 169 ms
54,684 KB
testcase_41 AC 177 ms
54,368 KB
testcase_42 AC 165 ms
54,392 KB
testcase_43 AC 169 ms
54,396 KB
testcase_44 AC 162 ms
54,744 KB
testcase_45 AC 165 ms
54,444 KB
testcase_46 AC 149 ms
54,352 KB
testcase_47 AC 174 ms
54,352 KB
testcase_48 AC 159 ms
54,432 KB
testcase_49 AC 151 ms
54,244 KB
testcase_50 AC 154 ms
54,512 KB
testcase_51 AC 157 ms
54,372 KB
testcase_52 AC 167 ms
54,332 KB
testcase_53 AC 165 ms
54,216 KB
testcase_54 AC 156 ms
54,256 KB
testcase_55 AC 155 ms
54,280 KB
testcase_56 AC 159 ms
54,676 KB
testcase_57 AC 148 ms
54,464 KB
testcase_58 AC 169 ms
54,608 KB
testcase_59 AC 171 ms
54,332 KB
testcase_60 AC 152 ms
54,388 KB
testcase_61 AC 167 ms
54,208 KB
testcase_62 AC 147 ms
54,256 KB
testcase_63 AC 147 ms
54,372 KB
testcase_64 AC 151 ms
54,600 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