結果

問題 No.254 文字列の構成
ユーザー H3PO4H3PO4
提出日時 2020-09-10 09:37:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,576 KB
実行使用メモリ 8,560 KB
最終ジャッジ日時 2023-08-23 12:50:00
合計ジャッジ時間 3,273 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,224 KB
testcase_01 AC 15 ms
8,232 KB
testcase_02 AC 17 ms
8,312 KB
testcase_03 AC 16 ms
8,324 KB
testcase_04 AC 16 ms
8,244 KB
testcase_05 AC 15 ms
8,340 KB
testcase_06 AC 15 ms
8,336 KB
testcase_07 AC 15 ms
8,344 KB
testcase_08 AC 15 ms
8,336 KB
testcase_09 AC 16 ms
8,312 KB
testcase_10 AC 16 ms
8,228 KB
testcase_11 AC 15 ms
8,160 KB
testcase_12 AC 15 ms
8,224 KB
testcase_13 AC 16 ms
8,228 KB
testcase_14 AC 16 ms
8,344 KB
testcase_15 AC 17 ms
8,436 KB
testcase_16 AC 26 ms
8,400 KB
testcase_17 AC 94 ms
8,400 KB
testcase_18 AC 93 ms
8,444 KB
testcase_19 AC 82 ms
8,500 KB
testcase_20 AC 57 ms
8,420 KB
testcase_21 AC 85 ms
8,560 KB
testcase_22 AC 35 ms
8,308 KB
testcase_23 AC 49 ms
8,488 KB
testcase_24 AC 49 ms
8,420 KB
testcase_25 AC 78 ms
8,456 KB
testcase_26 AC 75 ms
8,440 KB
testcase_27 AC 77 ms
8,456 KB
testcase_28 AC 64 ms
8,504 KB
testcase_29 AC 88 ms
8,408 KB
testcase_30 AC 83 ms
8,508 KB
testcase_31 AC 32 ms
8,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
from math import isqrt

N = int(input())

ans = ''

sqN = isqrt(N)
it_ab = itertools.cycle('ab')
for _ in range(sqN * 2 - 1):
    ans += next(it_ab)
N -= sqN ** 2

sqN = isqrt(N)
it_ab = itertools.cycle('cd')
for _ in range(sqN * 2 - 1):
    ans += next(it_ab)
N -= sqN ** 2

it_xyz = itertools.cycle('xyz')
for _ in range(N):
    ans += next(it_xyz)

# assert len(ans) <= 10 ** 5
print(ans)
0