結果

問題 No.701 ひとりしりとり
ユーザー letrangerjpletrangerjp
提出日時 2018-06-15 22:31:16
言語 Ruby
(3.2.2)
結果
AC  
実行時間 711 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 11,388 KB
実行使用メモリ 30,264 KB
最終ジャッジ日時 2023-09-13 04:50:00
合計ジャッジ時間 2,807 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,080 KB
testcase_01 AC 83 ms
15,320 KB
testcase_02 AC 81 ms
15,088 KB
testcase_03 AC 81 ms
15,040 KB
testcase_04 AC 81 ms
15,176 KB
testcase_05 AC 80 ms
15,196 KB
testcase_06 AC 81 ms
15,284 KB
testcase_07 AC 82 ms
15,084 KB
testcase_08 AC 82 ms
15,196 KB
testcase_09 AC 87 ms
15,308 KB
testcase_10 AC 136 ms
16,680 KB
testcase_11 AC 711 ms
30,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

memo = {}
chars = [*?a..?z]
last_chars = [*?a..?z]-[?n]
first_char = chars.sample

(N-1).times{
  last_char = last_chars.sample
  s = first_char + rand(0..18).times.map{chars.sample}*"" + last_char
  redo if memo[s]
  memo[s] = true
  puts s
  first_char = last_char
}
puts first_char + ?n
0