結果
問題 | No.701 ひとりしりとり |
ユーザー |
|
提出日時 | 2020-05-06 16:47:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 22,144 KB |
最終ジャッジ日時 | 2024-06-28 18:29:48 |
合計ジャッジ時間 | 3,048 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 10 |
ソースコード
import syssys.setrecursionlimit(100000000)input = sys.stdin.readlineMOD = 10 ** 9 + 7INF = 10 ** 15from itertools import permutationsdef 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')breakword = chr(i%26 + 97)if word == 'a':before = ''.join(next(itr))word += beforeword += chr((i + 1)%26 + 97)shiritori.append(word)print('\n'.join(shiritori))if __name__ == '__main__':main()