結果

問題 No.254 文字列の構成
ユーザー cielciel
提出日時 2015-07-25 00:04:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 16,144 KB
最終ジャッジ日時 2023-09-23 01:16:55
合計ジャッジ時間 5,612 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,400 KB
testcase_01 AC 83 ms
15,556 KB
testcase_02 AC 84 ms
15,588 KB
testcase_03 AC 84 ms
15,520 KB
testcase_04 AC 87 ms
15,412 KB
testcase_05 AC 83 ms
15,392 KB
testcase_06 AC 83 ms
15,400 KB
testcase_07 AC 86 ms
15,516 KB
testcase_08 AC 83 ms
15,624 KB
testcase_09 AC 82 ms
15,620 KB
testcase_10 AC 82 ms
15,600 KB
testcase_11 AC 81 ms
15,296 KB
testcase_12 AC 84 ms
15,448 KB
testcase_13 AC 82 ms
15,392 KB
testcase_14 AC 82 ms
15,412 KB
testcase_15 AC 83 ms
15,408 KB
testcase_16 AC 78 ms
15,404 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 81 ms
15,408 KB
testcase_23 AC 82 ms
15,580 KB
testcase_24 AC 83 ms
15,620 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 83 ms
15,404 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/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)%26).chr+(97+(2*i+1)%26).chr)*(e-1) + (97+(2*i)%26).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)
0