結果

問題 No.600 かい文回
ユーザー vwxyz
提出日時 2022-08-08 15:59:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 1,269 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,152 KB
最終ジャッジ日時 2024-09-19 01:52:54
合計ジャッジ時間 4,153 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

def check(S):
    N=len(S)
    ans=0
    for bit in range(1<<N-1):
        bound=[0]+[i+1 for i in range(N-1) if bit&1<<i]+[N]
        le=len(bound)
        lst=[S[bound[i]:bound[i+1]] for i in range(le-1)]
        if lst==lst[::-1]:
            ans+=1
    return ans

alp=[chr(i) for i in range(97,97+26)]
lst=[a+b for a in alp[:13] for b in alp[13:]]
def main(N):
    if N==1:
        return lst.pop()
    if N==2:
        return lst.pop()*2
    n=0
    while N%2==0:
        N//=2
        n+=1
    N-=1
    S=lst.pop()
    return S*(n+1)+main(N)+S*(n+1)
    
N=int(readline())
ans=main(N)
print(ans)
0