結果
| 問題 | No.689 E869120 and Constructing Array 3 |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-01-25 12:49:16 |
| 言語 | Ruby (4.0.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 8,704 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-03-13 12:30:48 |
| 合計ジャッジ時間 | 5,835 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 13 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'prime'
K = gets.to_i
def solver(k)
if k < 5050
n = (1..100).find { |x| (1..x).sum > k } - 1
ans = [1] * n + [2] + [8]
remain = k - (1..n).sum
remain.times do
ans << 23
end
ans
else
ans = [1] * 100 + [2]
remain = k - 5050
(remain / 100).times do
ans << 2
end
ans << 8
remain %= 100
remain.times do
ans << 23
end
ans
end
end
res = solver(K)
puts res.join(' ')
siman