結果

問題 No.701 ひとりしりとり
ユーザー mizomizo
提出日時 2018-07-01 19:16:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 404 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 15,460 KB
最終ジャッジ日時 2023-09-13 16:39:48
合計ジャッジ時間 2,336 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,032 KB
testcase_01 AC 83 ms
15,284 KB
testcase_02 AC 78 ms
15,156 KB
testcase_03 AC 78 ms
15,144 KB
testcase_04 AC 79 ms
15,064 KB
testcase_05 AC 79 ms
15,312 KB
testcase_06 AC 77 ms
15,036 KB
testcase_07 AC 79 ms
15,284 KB
testcase_08 AC 80 ms
15,152 KB
testcase_09 AC 84 ms
15,388 KB
testcase_10 AC 113 ms
15,284 KB
testcase_11 AC 404 ms
15,460 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$word = Array.new(5,97)	# a = 97
digit = 1

def countup(digit)			# def の引数指定が、この方法でよいのか、よく分からない
	$word[digit] += 1

	if $word[digit] == 123
		$word[digit] = 97 # zを 越えたら a にリセット
		digit += 1
		countup(digit)
	end

	digit = 1
end

(gets.to_i - 1).times do
	puts "a" + $word.each.map(&:chr).join + "a"
	countup(digit)
end

puts "a" + $word.each.map(&:chr).join + "n"

0