結果
| 問題 | No.701 ひとりしりとり | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-05-01 13:46:18 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 194 ms / 2,000 ms | 
| コード長 | 325 bytes | 
| コンパイル時間 | 410 ms | 
| コンパイル使用メモリ | 82,620 KB | 
| 実行使用メモリ | 91,944 KB | 
| 最終ジャッジ日時 | 2025-05-01 13:46:22 | 
| 合計ジャッジ時間 | 3,852 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 | 
ソースコード
from itertools import product
A = [chr(i) for i in range(97,123)]
A.remove("n")
C = {}
for a in A:
    C[a] = []
    for z in product(A,repeat=3):
        if a!=z[-1]:
            C[a].append(a+"".join(z))
N = int(input())
cnt = 0
x = "a"
while cnt<N-1:
    y = C[x].pop()
    print(y)
    cnt += 1
    x = y[-1]
print(x+"n")
            
            
            
        