結果

問題 No.701 ひとりしりとり
ユーザー neko_the_shadowneko_the_shadow
提出日時 2018-06-15 23:05:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 11,476 KB
実行使用メモリ 15,284 KB
最終ジャッジ日時 2023-09-13 05:07:39
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,000 KB
testcase_01 AC 80 ms
15,224 KB
testcase_02 AC 81 ms
15,180 KB
testcase_03 AC 80 ms
15,128 KB
testcase_04 AC 80 ms
15,012 KB
testcase_05 AC 81 ms
15,104 KB
testcase_06 AC 81 ms
15,036 KB
testcase_07 AC 81 ms
15,080 KB
testcase_08 AC 80 ms
15,128 KB
testcase_09 AC 85 ms
15,148 KB
testcase_10 AC 94 ms
15,164 KB
testcase_11 AC 177 ms
15,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def main(n)
  if n == 1
    puts "n"
    return
  end

  cnt = 0
  (1..Float::INFINITY).each do |i|
    [*'a'..'z'].repeated_permutation(i) do |chars|
      puts "a#{chars.join}a"
      cnt += 1
      if cnt == n - 1
        puts "an"
        return
      end
    end
  end
end


n = gets.to_i
main(n)
0