結果

問題 No.254 文字列の構成
ユーザー tnoda_tnoda_
提出日時 2015-08-31 16:00:37
言語 Python2
(2.7.18)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 6,700 KB
実行使用メモリ 6,620 KB
最終ジャッジ日時 2023-09-25 21:13:34
合計ジャッジ時間 2,910 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,152 KB
testcase_01 AC 12 ms
6,156 KB
testcase_02 AC 13 ms
6,012 KB
testcase_03 AC 13 ms
6,040 KB
testcase_04 AC 12 ms
6,072 KB
testcase_05 AC 11 ms
6,168 KB
testcase_06 AC 12 ms
6,012 KB
testcase_07 AC 11 ms
6,060 KB
testcase_08 AC 11 ms
6,076 KB
testcase_09 AC 12 ms
6,064 KB
testcase_10 AC 11 ms
6,040 KB
testcase_11 AC 12 ms
6,064 KB
testcase_12 AC 11 ms
6,084 KB
testcase_13 AC 12 ms
6,064 KB
testcase_14 AC 12 ms
6,028 KB
testcase_15 AC 12 ms
6,204 KB
testcase_16 AC 13 ms
6,252 KB
testcase_17 AC 17 ms
6,564 KB
testcase_18 AC 17 ms
6,524 KB
testcase_19 AC 16 ms
6,592 KB
testcase_20 AC 15 ms
6,464 KB
testcase_21 AC 16 ms
6,584 KB
testcase_22 AC 14 ms
6,324 KB
testcase_23 AC 15 ms
6,424 KB
testcase_24 AC 15 ms
6,416 KB
testcase_25 AC 17 ms
6,560 KB
testcase_26 AC 17 ms
6,504 KB
testcase_27 AC 16 ms
6,532 KB
testcase_28 AC 15 ms
6,576 KB
testcase_29 AC 16 ms
6,548 KB
testcase_30 AC 16 ms
6,620 KB
testcase_31 AC 13 ms
6,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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