結果

問題 No.701 ひとりしりとり
ユーザー NieRNieR
提出日時 2018-06-16 02:31:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 714 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 20,164 KB
最終ジャッジ日時 2023-09-13 05:46:56
合計ジャッジ時間 2,134 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,892 KB
testcase_01 AC 19 ms
8,752 KB
testcase_02 AC 20 ms
8,864 KB
testcase_03 AC 20 ms
8,908 KB
testcase_04 AC 19 ms
8,804 KB
testcase_05 AC 20 ms
8,892 KB
testcase_06 AC 19 ms
8,756 KB
testcase_07 AC 19 ms
8,736 KB
testcase_08 AC 20 ms
8,812 KB
testcase_09 AC 25 ms
8,920 KB
testcase_10 AC 87 ms
9,900 KB
testcase_11 AC 714 ms
20,164 KB
権限があれば一括ダウンロードができます

ソースコード

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