結果

問題 No.254 文字列の構成
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-29 23:31:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-16 00:22:16
合計ジャッジ時間 6,237 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
10,752 KB
testcase_01 AC 35 ms
10,880 KB
testcase_02 AC 34 ms
10,880 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
10,752 KB
testcase_12 AC 37 ms
10,752 KB
testcase_13 AC 282 ms
11,136 KB
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 #

from string import ascii_lowercase


def tmp(N):
    l = 0
    r = 10 ** 6
    while r - l > 1:
        m = (l + r) // 2
        M = m * 2
        if M * (M + 2) // 4 > N:
            r = m
        else:
            l = m
    return l * 2


N = int(input())
if N <= 10 ** 5:
    ans = ""
    for i in range(N):
        i %= len(ascii_lowercase)
        ans += ascii_lowercase[i]
    print(ans)
else:
    ans = ""
    L = tmp(N)
    for i in range(L):
        if i % 2 == 0:
            ans += "x"
        else:
            ans += "y"
    R = N - (L * (L + 2) // 2)
    for i in range(R):
        i %= len(ascii_lowercase)
        ans += ascii_lowercase[i]
    print(ans)
0