結果

問題 No.254 文字列の構成
コンテスト
ユーザー tnoda_
提出日時 2015-08-31 16:00:37
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 401 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 165 ms
コンパイル使用メモリ 77,772 KB
最終ジャッジ日時 2025-12-03 16:30:50
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import sqrt, floor

N = input()
ans = []
while N > 0:
    x = int(floor(sqrt(N)))
    ans.append(x)
    N -= x * x


def to_iwi(n, idx):
    c0 = chr(idx + ord('a'))
    c1 = chr(idx + ord('a') + 1)
    res = [c0]
    for i in xrange(n):
        res.append(c1)
        res.append(c0)
    return ''.join(res)

ans = [to_iwi(ans[i]-1, (i % 13)*2) for i in xrange(len(ans))]
print(''.join(ans))
0