結果

問題 No.701 ひとりしりとり
ユーザー MineMine
提出日時 2020-09-16 13:24:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 688 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 20,044 KB
最終ジャッジ日時 2023-09-04 03:26:48
合計ジャッジ時間 2,309 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
9,116 KB
testcase_01 AC 20 ms
8,980 KB
testcase_02 AC 21 ms
9,148 KB
testcase_03 AC 22 ms
9,028 KB
testcase_04 AC 21 ms
8,972 KB
testcase_05 AC 21 ms
9,000 KB
testcase_06 AC 21 ms
9,132 KB
testcase_07 AC 21 ms
9,060 KB
testcase_08 AC 21 ms
9,044 KB
testcase_09 AC 27 ms
9,176 KB
testcase_10 AC 84 ms
9,944 KB
testcase_11 AC 688 ms
20,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import random
n = int(input())
al = [chr(i) for i in range(97, 97+26)]
d = defaultdict(bool)

for i in range(n-1):
    ok = False
    while not ok:
        ans = ""
        for g in range(6):
            rnd = random.randint(0, len(al)-1)
            ans += al[rnd]
        if not d[ans]:
            print("a"+ ans +"a")
            d[ans] = True
            ok = True
print("an")

0