結果
問題 | No.701 ひとりしりとり |
ユーザー |
|
提出日時 | 2020-05-06 16:52:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 876 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,504 KB |
最終ジャッジ日時 | 2024-06-28 18:36:17 |
合計ジャッジ時間 | 1,956 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 9 |
ソースコード
import syssys.setrecursionlimit(100000000)input = sys.stdin.readlineMOD = 10 ** 9 + 7INF = 10 ** 15from itertools import permutationsdef main():N = int(input())if N == 1:print('n')returnshiritori = ['a']itr = permutations('abcedfghiijklmnopqrstubwxyz',18)before = ''.join(next(itr))i = 0while i + 1 < N:if i == N - 2:shiritori.append(chr(i%26 + 97) + 'n')breakif i%26 == 13:i += 1continueword = chr(i%26 + 97)if word == 'a':before = ''.join(next(itr))word += beforeif i%26 == 12:word += chr((i + 2)%26 + 97)else:word += chr((i + 1)%26 + 97)shiritori.append(word)i += 1print('\n'.join(shiritori))if __name__ == '__main__':main()