結果

問題 No.701 ひとりしりとり
ユーザー kobaya0514kobaya0514
提出日時 2018-06-15 23:34:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-30 15:32:02
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n=int(input())

def solve(a):
  if a==1:
    print("n")
    return

  ans="abcdefghi"
  cnt_str="abcdefghijklmopqrstuvwxyz"
  cnt=0
  for s in itertools.permutations(ans):
    start=cnt%25
    end=start+1
    if end==25:
      end=0
    print(cnt_str[start]+"".join(list(s))+cnt_str[end])
    cnt+=1
    if cnt==(a-1):
      print(cnt_str[end]+"".join(list(s))+"n")
      break
  return

solve(n)
0