結果

問題 No.736 約比
ユーザー 37zigen37zigen
提出日時 2018-09-28 22:01:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 79,620 KB
実行使用メモリ 55,524 KB
最終ジャッジ日時 2024-04-20 10:45:51
合計ジャッジ時間 14,959 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
54,892 KB
testcase_01 AC 168 ms
55,124 KB
testcase_02 AC 168 ms
55,144 KB
testcase_03 AC 172 ms
55,012 KB
testcase_04 AC 176 ms
55,352 KB
testcase_05 AC 165 ms
54,884 KB
testcase_06 AC 164 ms
55,092 KB
testcase_07 AC 178 ms
55,136 KB
testcase_08 AC 175 ms
55,172 KB
testcase_09 AC 172 ms
55,324 KB
testcase_10 AC 177 ms
55,144 KB
testcase_11 AC 189 ms
55,180 KB
testcase_12 AC 178 ms
55,168 KB
testcase_13 AC 184 ms
55,264 KB
testcase_14 AC 168 ms
55,284 KB
testcase_15 AC 185 ms
55,264 KB
testcase_16 AC 155 ms
55,128 KB
testcase_17 AC 176 ms
55,292 KB
testcase_18 AC 175 ms
55,144 KB
testcase_19 AC 170 ms
55,280 KB
testcase_20 AC 173 ms
55,224 KB
testcase_21 AC 159 ms
54,908 KB
testcase_22 AC 156 ms
54,792 KB
testcase_23 AC 159 ms
54,972 KB
testcase_24 AC 178 ms
55,336 KB
testcase_25 AC 160 ms
54,884 KB
testcase_26 AC 162 ms
55,096 KB
testcase_27 AC 177 ms
55,084 KB
testcase_28 AC 176 ms
55,236 KB
testcase_29 AC 147 ms
54,720 KB
testcase_30 AC 176 ms
55,240 KB
testcase_31 AC 158 ms
54,768 KB
testcase_32 AC 158 ms
54,848 KB
testcase_33 AC 173 ms
55,264 KB
testcase_34 AC 143 ms
54,996 KB
testcase_35 AC 160 ms
55,084 KB
testcase_36 AC 172 ms
54,980 KB
testcase_37 AC 176 ms
55,148 KB
testcase_38 AC 175 ms
55,324 KB
testcase_39 AC 149 ms
54,628 KB
testcase_40 AC 179 ms
55,172 KB
testcase_41 AC 175 ms
55,160 KB
testcase_42 AC 172 ms
55,524 KB
testcase_43 AC 174 ms
55,156 KB
testcase_44 AC 167 ms
55,028 KB
testcase_45 AC 177 ms
55,368 KB
testcase_46 AC 160 ms
54,896 KB
testcase_47 AC 176 ms
55,124 KB
testcase_48 AC 169 ms
55,312 KB
testcase_49 AC 164 ms
55,104 KB
testcase_50 AC 168 ms
55,012 KB
testcase_51 AC 170 ms
54,972 KB
testcase_52 AC 175 ms
55,296 KB
testcase_53 AC 174 ms
55,364 KB
testcase_54 AC 168 ms
55,196 KB
testcase_55 AC 152 ms
55,084 KB
testcase_56 AC 157 ms
54,644 KB
testcase_57 AC 158 ms
55,028 KB
testcase_58 AC 179 ms
55,152 KB
testcase_59 AC 182 ms
55,020 KB
testcase_60 AC 174 ms
55,140 KB
testcase_61 AC 181 ms
55,372 KB
testcase_62 AC 167 ms
54,880 KB
testcase_63 AC 160 ms
55,148 KB
testcase_64 AC 150 ms
54,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	final long MOD = (long) (1e9 + 7);

	public void run() throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long gcd = a[0];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextLong();
			gcd = gcd(a[i], gcd);
		}
		for (int i = 0; i < n; ++i) {
			a[i] /= gcd;
		}
		for (int i = 0; i < n; ++i) {
			System.out.print(a[i] + (i == n - 1 ? "\n" : ":"));
		}
	}

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

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0