結果

問題 No.701 ひとりしりとり
ユーザー finefine
提出日時 2018-06-15 22:28:56
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 360 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 11,564 KB
実行使用メモリ 35,984 KB
最終ジャッジ日時 2023-09-13 04:49:26
合計ジャッジ時間 5,528 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
19,584 KB
testcase_01 AC 83 ms
15,120 KB
testcase_02 AC 89 ms
15,116 KB
testcase_03 AC 83 ms
15,040 KB
testcase_04 AC 85 ms
15,180 KB
testcase_05 AC 82 ms
15,132 KB
testcase_06 AC 83 ms
15,276 KB
testcase_07 AC 83 ms
15,252 KB
testcase_08 AC 84 ms
15,412 KB
testcase_09 AC 108 ms
15,204 KB
testcase_10 AC 375 ms
18,132 KB
testcase_11 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:17: warning: assigned but unused variable - foo
Syntax OK

ソースコード

diff #

def hoge(h)
    loop {
        s = ""
        18.times do
            s += (rand(26) + ?a.ord).chr
        end
        if !h.has_key?(s)
            h[s] = 1
            return s
        end
   }
end

h = {}
n = gets.to_i
n.times do |i|
    foo = hoge(h)
    if i + 1 == n
        puts "a" + hoge(h) + "n"
    else
        puts "a" + hoge(h) + "a"
    end
end
0