結果
| 問題 |
No.254 文字列の構成
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-25 00:02:30 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 314 bytes |
| コンパイル時間 | 201 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2024-07-16 01:14:10 |
| 合計ジャッジ時間 | 5,706 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 WA * 11 |
コンパイルメッセージ
Syntax OK
ソースコード
#!/usr/bin/ruby
M=10000
A=(1..M).map{|i|i*i}.reverse
def dfs(lst,n,last)
if n==0
puts lst.each_with_index.map{|e,i|((97+2*i).chr+(97+2*i+1).chr)*(e-1) + (97+2*i).chr}*''
exit
else
last.step(A.size-1){|i|
d,r=n.divmod(A[i])
if d>0
dfs(lst+[M-i]*d,r,i+1)
end
}
end
end
N=gets.to_i
dfs([],N,0)