結果

問題 No.736 約比
ユーザー YamaKasaYamaKasa
提出日時 2018-09-28 21:35:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 2,285 ms
コンパイル使用メモリ 79,556 KB
実行使用メモリ 54,624 KB
最終ジャッジ日時 2024-04-20 10:12:50
合計ジャッジ時間 14,710 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
54,412 KB
testcase_01 AC 164 ms
54,196 KB
testcase_02 AC 157 ms
54,324 KB
testcase_03 AC 172 ms
54,580 KB
testcase_04 AC 169 ms
54,380 KB
testcase_05 AC 158 ms
54,268 KB
testcase_06 AC 150 ms
54,624 KB
testcase_07 AC 173 ms
54,244 KB
testcase_08 AC 171 ms
54,408 KB
testcase_09 AC 164 ms
54,572 KB
testcase_10 AC 169 ms
54,340 KB
testcase_11 AC 169 ms
54,380 KB
testcase_12 AC 171 ms
54,544 KB
testcase_13 AC 170 ms
54,132 KB
testcase_14 AC 164 ms
54,556 KB
testcase_15 AC 167 ms
54,468 KB
testcase_16 AC 178 ms
54,472 KB
testcase_17 AC 178 ms
54,352 KB
testcase_18 AC 168 ms
54,096 KB
testcase_19 AC 165 ms
54,552 KB
testcase_20 AC 169 ms
54,308 KB
testcase_21 AC 170 ms
54,440 KB
testcase_22 AC 152 ms
54,532 KB
testcase_23 AC 151 ms
54,300 KB
testcase_24 AC 169 ms
54,272 KB
testcase_25 AC 151 ms
54,280 KB
testcase_26 AC 152 ms
54,404 KB
testcase_27 AC 170 ms
54,604 KB
testcase_28 AC 170 ms
54,164 KB
testcase_29 AC 147 ms
54,580 KB
testcase_30 AC 168 ms
54,324 KB
testcase_31 AC 155 ms
54,372 KB
testcase_32 AC 150 ms
54,340 KB
testcase_33 AC 175 ms
54,612 KB
testcase_34 AC 148 ms
54,292 KB
testcase_35 AC 148 ms
54,336 KB
testcase_36 AC 170 ms
54,472 KB
testcase_37 AC 170 ms
54,532 KB
testcase_38 AC 170 ms
54,496 KB
testcase_39 AC 149 ms
54,352 KB
testcase_40 AC 168 ms
54,312 KB
testcase_41 AC 169 ms
54,380 KB
testcase_42 AC 167 ms
54,360 KB
testcase_43 AC 171 ms
54,264 KB
testcase_44 AC 166 ms
54,024 KB
testcase_45 AC 167 ms
54,544 KB
testcase_46 AC 151 ms
54,292 KB
testcase_47 AC 171 ms
54,376 KB
testcase_48 AC 163 ms
54,308 KB
testcase_49 AC 156 ms
54,432 KB
testcase_50 AC 155 ms
54,504 KB
testcase_51 AC 158 ms
54,508 KB
testcase_52 AC 170 ms
54,480 KB
testcase_53 AC 164 ms
54,536 KB
testcase_54 AC 165 ms
54,568 KB
testcase_55 AC 155 ms
54,624 KB
testcase_56 AC 163 ms
54,540 KB
testcase_57 AC 151 ms
54,388 KB
testcase_58 AC 174 ms
54,552 KB
testcase_59 AC 170 ms
54,316 KB
testcase_60 AC 156 ms
54,364 KB
testcase_61 AC 171 ms
54,372 KB
testcase_62 AC 149 ms
54,172 KB
testcase_63 AC 148 ms
54,396 KB
testcase_64 AC 149 ms
54,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		long[]a = new long[N];
		for(int i = 0; i < N; i++) {
			a[i] = scan.nextLong();
		}
		scan.close();
		long g = gcd(a[0], a[1]);
		for(int i = 2; i < N; i++) {
			g = gcd(g, a[i]);
		}
		long[]b = new long[N];
		for(int i = 0; i < N; i++) {
			b[i] = a[i] / g;
		}
		for(int i = 0; i < N; i++) {
			long t = a[i] / g;
			if(i == N - 1) {
				System.out.println(t);
			}else {
				System.out.print(t + ":");
			}
		}
	}
	static long gcd(long m, long n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
}
0