結果

問題 No.2609 Decreasing GCDs
ユーザー maguroflymagurofly
提出日時 2024-01-19 21:41:21
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 279 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,512 KB
最終ジャッジ日時 2024-01-19 21:41:26
合計ジャッジ時間 4,490 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
16,512 KB
testcase_01 AC 101 ms
16,512 KB
testcase_02 AC 101 ms
16,512 KB
testcase_03 AC 120 ms
16,512 KB
testcase_04 AC 100 ms
16,512 KB
testcase_05 AC 99 ms
16,512 KB
testcase_06 AC 99 ms
16,512 KB
testcase_07 AC 100 ms
16,512 KB
testcase_08 AC 101 ms
16,512 KB
testcase_09 AC 98 ms
16,512 KB
testcase_10 AC 99 ms
16,512 KB
testcase_11 AC 102 ms
16,512 KB
testcase_12 AC 103 ms
16,512 KB
testcase_13 AC 114 ms
16,512 KB
testcase_14 AC 102 ms
16,512 KB
testcase_15 AC 102 ms
16,512 KB
testcase_16 AC 104 ms
16,512 KB
testcase_17 AC 100 ms
16,512 KB
testcase_18 AC 106 ms
16,512 KB
testcase_19 AC 100 ms
16,512 KB
testcase_20 AC 103 ms
16,512 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "prime"

N = gets.to_i
gcds = Prime.take(2 + N - 1).to_a[2..][0, N - 1].reverse
A = [1] * N
(0 ... N - 1).each do |i|
	g = gcds[i]
	A[i] *= g
	A[i + 1] *= g
end
(1 ... N).each do |i|
	p = (i % 2 == 0 ? 2 : 3)
	while A[i - 1] >= A[i]
		A[i] *= p
	end
end

puts A.join(" ")
0