結果

問題 No.501 穴と文字列
ユーザー minrminr
提出日時 2020-03-28 20:55:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 10,492 KB
実行使用メモリ 8,376 KB
最終ジャッジ日時 2023-08-30 18:18:07
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
8,100 KB
testcase_02 AC 14 ms
7,908 KB
testcase_03 AC 15 ms
7,816 KB
testcase_04 AC 15 ms
7,856 KB
testcase_05 AC 14 ms
7,972 KB
testcase_06 AC 15 ms
7,816 KB
testcase_07 AC 15 ms
7,784 KB
testcase_08 AC 14 ms
7,852 KB
testcase_09 AC 15 ms
7,828 KB
testcase_10 WA -
testcase_11 AC 15 ms
7,936 KB
testcase_12 AC 16 ms
7,784 KB
testcase_13 AC 15 ms
7,784 KB
testcase_14 WA -
testcase_15 AC 15 ms
7,904 KB
testcase_16 AC 15 ms
7,904 KB
testcase_17 AC 15 ms
7,960 KB
testcase_18 AC 15 ms
8,216 KB
testcase_19 AC 15 ms
8,216 KB
testcase_20 WA -
testcase_21 AC 15 ms
8,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())
S = ""
cnt_a = 0
cnt_b = 0
cnt_c = 0
if D == 0:
    S = 'C' * N
elif D == 1:
    S = 'A' + 'C' * (N-1)
elif D >= N:
    cnt_a = D - 2*(D - N)
    cnt_b = D - N
    cnt_c = N - cnt_a - cnt_b
    S = 'A'*cnt_a + 'B'*cnt_b + 'C'*cnt_c
else:
    cnt_a = D - 2*(N - D)
    cnt_b = N - D
    cnt_c = N - cnt_a - cnt_b
    S = 'A'*cnt_a + 'B' * cnt_b + 'C'*cnt_c
print(S)
0