結果

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

ソースコード

diff #

import random

def aaa():
    while len(shiritori)<a:
        c = random.randint(1,18)
        for i in range(c):
            b = random.choice("abcdefghijklmopqrstuvwxyz")
            global word
            word = word + b

            if i == c-1:
                if len(shiritori)==a-1:
                    word = word+'n'

                setlen = len(shiritori)
                shiritori.add(word)
                if len(shiritori)==setlen:
                    word = word[0:1]
                if len(shiritori)>setlen:
                    print(word)
                    word = b

a = int(input())
word = random.choice("abcdefghijklmopqrstuvwxyz")
shiritori = set()
aaa()
0