結果
問題 | No.701 ひとりしりとり |
ユーザー | hedwig100 |
提出日時 | 2020-05-06 16:47:37 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 333 ms |
コンパイル使用メモリ | 10,940 KB |
実行使用メモリ | 20,804 KB |
最終ジャッジ日時 | 2023-09-11 03:58:14 |
合計ジャッジ時間 | 2,996 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 16 ms
8,052 KB |
testcase_02 | AC | 16 ms
8,180 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
ソースコード
import sys sys.setrecursionlimit(100000000) input = sys.stdin.readline MOD = 10 ** 9 + 7 INF = 10 ** 15 from itertools import permutations def main(): N = int(input()) shiritori = ['a'] itr = permutations('abcedfghiijklmnopqrstubwxyz',18) before = ''.join(next(itr)) for i in range(N - 1): if i == N - 2: shiritori.append(chr(i%26 + 97) + 'n') break word = chr(i%26 + 97) if word == 'a': before = ''.join(next(itr)) word += before word += chr((i + 1)%26 + 97) shiritori.append(word) print('\n'.join(shiritori)) if __name__ == '__main__': main()