結果

問題 No.254 文字列の構成
ユーザー mkawa2mkawa2
提出日時 2020-01-31 12:20:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 965 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,076 KB
実行使用メモリ 10,320 KB
最終ジャッジ日時 2023-10-17 08:17:56
合計ジャッジ時間 5,548 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,096 KB
testcase_01 AC 29 ms
10,096 KB
testcase_02 AC 30 ms
10,096 KB
testcase_03 AC 29 ms
10,096 KB
testcase_04 AC 29 ms
10,096 KB
testcase_05 AC 29 ms
10,096 KB
testcase_06 AC 30 ms
10,096 KB
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 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    n=II()
    aa=[]
    while n:
        a=0
        while (a+1)*2+1+(a+1)*(a+2)//2<=n:a+=1
        n-=a*2+1+a*(a+1)//2
        aa.append(a)
    #print(aa,n)
    ans=""
    for i,a in enumerate(aa):
        ans+=(chr(i*2+97)+chr(i*2+1+97))*a
        ans+=chr(i*2+97)
    print(ans)

main()
0