結果

問題 No.600 かい文回
ユーザー zimphazimpha
提出日時 2017-12-05 22:05:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 71,428 KB
最終ジャッジ日時 2023-08-19 04:05:29
合計ジャッジ時間 5,709 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,076 KB
testcase_01 AC 69 ms
71,424 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 68 ms
71,248 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 66 ms
71,108 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 69 ms
70,908 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

s = [chr(i + ord('a')) for i in range(26)]
s.extend(['ab', 'cd', 'ef', 'gh', 'ij', 'kl'])

def gen(level, n):
    if n == 1:
        return 'uvw'
    elif n % 2 == 1:
        return s[level] + gen(level + 1, n - 1) + s[level]
    cnt = 0
    while n % 2 == 0:
        n //= 2
        cnt += 1
    u = s[level] * cnt
    if n == 1:
        return u + 'uvw' + u
    else:
        return u + gen(level + 1, n - 1) + u

print(gen(0, int(input())))
0