結果

問題 No.736 約比
ユーザー GrenacheGrenache
提出日時 2019-04-26 21:04:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 3,436 ms
コンパイル使用メモリ 77,588 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-05-03 20:44:40
合計ジャッジ時間 13,651 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,440 KB
testcase_01 AC 128 ms
41,448 KB
testcase_02 AC 123 ms
41,368 KB
testcase_03 AC 129 ms
41,084 KB
testcase_04 AC 140 ms
41,784 KB
testcase_05 AC 123 ms
41,332 KB
testcase_06 AC 118 ms
41,272 KB
testcase_07 AC 131 ms
41,580 KB
testcase_08 AC 133 ms
41,560 KB
testcase_09 AC 131 ms
41,252 KB
testcase_10 AC 131 ms
40,984 KB
testcase_11 AC 135 ms
41,296 KB
testcase_12 AC 122 ms
40,504 KB
testcase_13 AC 127 ms
41,340 KB
testcase_14 AC 122 ms
41,192 KB
testcase_15 AC 135 ms
41,196 KB
testcase_16 AC 116 ms
40,264 KB
testcase_17 AC 130 ms
41,292 KB
testcase_18 AC 132 ms
41,344 KB
testcase_19 AC 127 ms
41,156 KB
testcase_20 AC 129 ms
41,280 KB
testcase_21 AC 113 ms
40,356 KB
testcase_22 AC 111 ms
40,020 KB
testcase_23 AC 117 ms
41,464 KB
testcase_24 AC 138 ms
41,528 KB
testcase_25 AC 121 ms
41,244 KB
testcase_26 AC 119 ms
40,916 KB
testcase_27 AC 133 ms
41,552 KB
testcase_28 AC 124 ms
41,296 KB
testcase_29 AC 115 ms
40,908 KB
testcase_30 AC 135 ms
41,044 KB
testcase_31 AC 119 ms
40,780 KB
testcase_32 AC 122 ms
40,952 KB
testcase_33 AC 129 ms
41,592 KB
testcase_34 AC 110 ms
40,168 KB
testcase_35 AC 111 ms
40,756 KB
testcase_36 AC 133 ms
41,592 KB
testcase_37 AC 131 ms
41,460 KB
testcase_38 AC 133 ms
41,448 KB
testcase_39 AC 124 ms
40,988 KB
testcase_40 AC 134 ms
41,092 KB
testcase_41 AC 133 ms
41,460 KB
testcase_42 AC 132 ms
41,380 KB
testcase_43 AC 132 ms
41,328 KB
testcase_44 AC 126 ms
41,044 KB
testcase_45 AC 134 ms
41,440 KB
testcase_46 AC 108 ms
40,036 KB
testcase_47 AC 133 ms
41,096 KB
testcase_48 AC 127 ms
41,568 KB
testcase_49 AC 122 ms
41,116 KB
testcase_50 AC 119 ms
41,256 KB
testcase_51 AC 126 ms
41,576 KB
testcase_52 AC 136 ms
41,424 KB
testcase_53 AC 131 ms
41,700 KB
testcase_54 AC 129 ms
41,080 KB
testcase_55 AC 127 ms
41,016 KB
testcase_56 AC 127 ms
40,936 KB
testcase_57 AC 117 ms
40,944 KB
testcase_58 AC 132 ms
41,164 KB
testcase_59 AC 135 ms
41,360 KB
testcase_60 AC 131 ms
41,504 KB
testcase_61 AC 129 ms
41,332 KB
testcase_62 AC 124 ms
41,124 KB
testcase_63 AC 110 ms
39,932 KB
testcase_64 AC 133 ms
41,380 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