結果

問題 No.736 約比
ユーザー GrenacheGrenache
提出日時 2019-04-26 21:04:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 4,634 ms
コンパイル使用メモリ 74,268 KB
実行使用メモリ 57,940 KB
最終ジャッジ日時 2023-08-16 12:20:40
合計ジャッジ時間 16,798 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,832 KB
testcase_01 AC 138 ms
55,572 KB
testcase_02 AC 133 ms
56,096 KB
testcase_03 AC 139 ms
55,756 KB
testcase_04 AC 139 ms
55,788 KB
testcase_05 AC 128 ms
56,076 KB
testcase_06 AC 127 ms
55,428 KB
testcase_07 AC 139 ms
55,748 KB
testcase_08 AC 138 ms
56,040 KB
testcase_09 AC 137 ms
55,840 KB
testcase_10 AC 137 ms
55,716 KB
testcase_11 AC 136 ms
56,268 KB
testcase_12 AC 137 ms
56,032 KB
testcase_13 AC 137 ms
56,360 KB
testcase_14 AC 131 ms
56,188 KB
testcase_15 AC 136 ms
55,776 KB
testcase_16 AC 135 ms
55,732 KB
testcase_17 AC 141 ms
55,820 KB
testcase_18 AC 138 ms
55,656 KB
testcase_19 AC 135 ms
55,984 KB
testcase_20 AC 141 ms
55,832 KB
testcase_21 AC 138 ms
55,812 KB
testcase_22 AC 126 ms
55,952 KB
testcase_23 AC 127 ms
55,896 KB
testcase_24 AC 141 ms
55,560 KB
testcase_25 AC 129 ms
56,148 KB
testcase_26 AC 123 ms
55,956 KB
testcase_27 AC 138 ms
55,812 KB
testcase_28 AC 141 ms
56,116 KB
testcase_29 AC 126 ms
56,192 KB
testcase_30 AC 136 ms
56,188 KB
testcase_31 AC 125 ms
55,868 KB
testcase_32 AC 124 ms
55,808 KB
testcase_33 AC 138 ms
56,124 KB
testcase_34 AC 128 ms
57,940 KB
testcase_35 AC 128 ms
55,792 KB
testcase_36 AC 140 ms
56,152 KB
testcase_37 AC 139 ms
56,360 KB
testcase_38 AC 139 ms
55,636 KB
testcase_39 AC 127 ms
55,900 KB
testcase_40 AC 141 ms
55,800 KB
testcase_41 AC 138 ms
56,144 KB
testcase_42 AC 133 ms
55,904 KB
testcase_43 AC 137 ms
55,888 KB
testcase_44 AC 133 ms
56,196 KB
testcase_45 AC 139 ms
55,792 KB
testcase_46 AC 128 ms
56,064 KB
testcase_47 AC 144 ms
56,020 KB
testcase_48 AC 134 ms
55,788 KB
testcase_49 AC 131 ms
55,696 KB
testcase_50 AC 130 ms
53,708 KB
testcase_51 AC 133 ms
55,444 KB
testcase_52 AC 137 ms
55,876 KB
testcase_53 AC 138 ms
55,764 KB
testcase_54 AC 134 ms
55,660 KB
testcase_55 AC 130 ms
56,008 KB
testcase_56 AC 131 ms
55,540 KB
testcase_57 AC 129 ms
56,020 KB
testcase_58 AC 137 ms
56,080 KB
testcase_59 AC 146 ms
55,784 KB
testcase_60 AC 132 ms
55,824 KB
testcase_61 AC 137 ms
56,232 KB
testcase_62 AC 125 ms
55,976 KB
testcase_63 AC 123 ms
56,068 KB
testcase_64 AC 124 ms
56,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Scanner;


public class Main_yukicoder736 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		
		long gcd = a[0];
		for (int i = 1; i < n; i++) {
			gcd = gcd(gcd, a[i]);
		}

		for (int i = 0; i < n; i++) {
			if (i > 0) {
				pr.print(':');
			}
			pr.print(a[i] / gcd);
		}
		pr.println();
	}

	static long gcd(long n, long m) {
		if (m == 0) {
			return n;
		} else {
			return gcd(m, n % m);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0