結果

問題 No.736 約比
ユーザー Mcpu3Mcpu3
提出日時 2018-09-29 00:55:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 4,136 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 56,072 KB
最終ジャッジ日時 2024-04-20 12:30:17
合計ジャッジ時間 15,217 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
54,212 KB
testcase_01 AC 140 ms
56,072 KB
testcase_02 AC 142 ms
54,204 KB
testcase_03 AC 148 ms
53,980 KB
testcase_04 AC 150 ms
54,272 KB
testcase_05 AC 134 ms
53,928 KB
testcase_06 AC 131 ms
54,268 KB
testcase_07 AC 152 ms
54,208 KB
testcase_08 AC 144 ms
54,348 KB
testcase_09 AC 146 ms
54,316 KB
testcase_10 AC 156 ms
54,260 KB
testcase_11 AC 150 ms
54,260 KB
testcase_12 AC 160 ms
54,208 KB
testcase_13 AC 152 ms
53,992 KB
testcase_14 AC 123 ms
53,096 KB
testcase_15 AC 146 ms
53,844 KB
testcase_16 AC 144 ms
54,500 KB
testcase_17 AC 149 ms
54,276 KB
testcase_18 AC 148 ms
54,408 KB
testcase_19 AC 145 ms
54,368 KB
testcase_20 AC 146 ms
54,492 KB
testcase_21 AC 145 ms
54,112 KB
testcase_22 AC 128 ms
53,784 KB
testcase_23 AC 124 ms
53,860 KB
testcase_24 AC 144 ms
54,408 KB
testcase_25 AC 127 ms
54,276 KB
testcase_26 AC 127 ms
54,264 KB
testcase_27 AC 148 ms
54,728 KB
testcase_28 AC 148 ms
54,048 KB
testcase_29 AC 127 ms
53,840 KB
testcase_30 AC 147 ms
54,440 KB
testcase_31 AC 122 ms
54,264 KB
testcase_32 AC 130 ms
54,020 KB
testcase_33 AC 146 ms
54,200 KB
testcase_34 AC 126 ms
53,836 KB
testcase_35 AC 113 ms
54,256 KB
testcase_36 AC 147 ms
54,228 KB
testcase_37 AC 143 ms
54,304 KB
testcase_38 AC 145 ms
54,144 KB
testcase_39 AC 126 ms
54,312 KB
testcase_40 AC 149 ms
54,372 KB
testcase_41 AC 149 ms
54,028 KB
testcase_42 AC 143 ms
54,276 KB
testcase_43 AC 144 ms
54,760 KB
testcase_44 AC 142 ms
54,268 KB
testcase_45 AC 146 ms
53,892 KB
testcase_46 AC 131 ms
54,552 KB
testcase_47 AC 150 ms
53,900 KB
testcase_48 AC 142 ms
54,412 KB
testcase_49 AC 131 ms
54,060 KB
testcase_50 AC 119 ms
52,920 KB
testcase_51 AC 137 ms
54,416 KB
testcase_52 AC 149 ms
54,280 KB
testcase_53 AC 145 ms
54,076 KB
testcase_54 AC 138 ms
54,632 KB
testcase_55 AC 136 ms
53,928 KB
testcase_56 AC 140 ms
54,484 KB
testcase_57 AC 127 ms
53,960 KB
testcase_58 AC 147 ms
54,116 KB
testcase_59 AC 148 ms
54,428 KB
testcase_60 AC 134 ms
54,168 KB
testcase_61 AC 148 ms
54,032 KB
testcase_62 AC 128 ms
54,208 KB
testcase_63 AC 128 ms
54,068 KB
testcase_64 AC 131 ms
54,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static long gcd(long x, long y) {
        long r;
        if (y > x) {
            r = x;
            x = y;
            y = r;
        }
        while (y > 0) {
            r = x % y;
            x = y;
            y = r;
        }
        return x;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long a[] = new long[N], tmp[] = new long[N];
        for (int i = 0; i < N; ++i) {
            a[i] = sc.nextLong();
            tmp[i] = a[i];
        }
        sc.close();
        for (int i = 1; i < N; ++i) tmp[i] = gcd(tmp[i - 1], tmp[i]);
        for (int i = 0; i < N; ++i) {
            System.out.print(a[i] / tmp[N - 1]);
            if (i != N - 1) System.out.print(":");
        }
    }
}
0