結果

問題 No.2609 Decreasing GCDs
ユーザー maguroflymagurofly
提出日時 2024-01-19 21:40:13
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 272 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,640 KB
最終ジャッジ日時 2024-01-19 21:40:34
合計ジャッジ時間 5,771 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

require "prime"

N = gets.to_i
gcds = Prime.each(30).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