結果

問題 No.701 ひとりしりとり
ユーザー brthyyjpbrthyyjp
提出日時 2020-07-22 03:48:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 98,944 KB
最終ジャッジ日時 2023-08-30 17:37:04
合計ジャッジ時間 3,816 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 183 ms
96,492 KB
testcase_01 AC 193 ms
96,600 KB
testcase_02 AC 187 ms
96,836 KB
testcase_03 AC 186 ms
96,600 KB
testcase_04 AC 186 ms
96,428 KB
testcase_05 AC 185 ms
96,764 KB
testcase_06 AC 184 ms
96,500 KB
testcase_07 AC 186 ms
96,492 KB
testcase_08 AC 188 ms
98,480 KB
testcase_09 AC 195 ms
98,676 KB
testcase_10 AC 203 ms
98,888 KB
testcase_11 AC 222 ms
98,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
X = [set() for _ in range(26)]
import itertools
for p in itertools.product(range(26), repeat=4):
    s = ''
    for i in range(4):
        s += chr(p[i]+ord('a'))
    if s[-1] == 'n':
        continue
    X[ord(s[0])-ord('a')].add(s)
#print(X[0].pop())

c = 0
for i in range(n):
    if i != n-1:
        s = X[c].pop()
        print(s)
        c = ord(s[-1])-ord('a')
    else:
        print(s[-1]+'n')
0