結果

問題 No.600 かい文回
ユーザー maspy
提出日時 2020-03-18 17:59:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-14 02:17:59
合計ジャッジ時間 1,930 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools

N = int(read())


def f(N, i):
    i %= 3
    a = str(i)
    if N == 1:
        return a
    if N == 2:
        return a + a
    if N & 1:
        return a + f(N - 1, i + 1) + a
    return a + a + f((N - 2) // 2, i + 1) + a + a

word = f(N, 0).replace('0', 'a').replace('1', 'b').replace('2', 'c')
print(word)
0