結果

問題 No.501 穴と文字列
ユーザー brthyyjpbrthyyjp
提出日時 2021-09-05 13:56:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 86,520 KB
実行使用メモリ 76,236 KB
最終ジャッジ日時 2023-08-23 14:12:35
合計ジャッジ時間 3,176 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
76,092 KB
testcase_01 AC 83 ms
76,068 KB
testcase_02 AC 71 ms
71,004 KB
testcase_03 AC 76 ms
71,272 KB
testcase_04 AC 72 ms
70,996 KB
testcase_05 AC 73 ms
70,928 KB
testcase_06 AC 71 ms
71,028 KB
testcase_07 AC 72 ms
71,332 KB
testcase_08 AC 72 ms
71,284 KB
testcase_09 AC 73 ms
71,268 KB
testcase_10 AC 72 ms
71,200 KB
testcase_11 AC 71 ms
71,068 KB
testcase_12 AC 73 ms
71,332 KB
testcase_13 AC 72 ms
71,292 KB
testcase_14 AC 73 ms
70,928 KB
testcase_15 AC 72 ms
71,212 KB
testcase_16 AC 73 ms
71,160 KB
testcase_17 AC 72 ms
71,000 KB
testcase_18 AC 76 ms
75,496 KB
testcase_19 AC 77 ms
75,372 KB
testcase_20 AC 82 ms
76,236 KB
testcase_21 AC 83 ms
75,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
YZX = []
for z in reversed(range(n+1)):
    x = n-d+z
    y = d-2*z
    if x >= 0 and y >= 0:
        #s = 'A'*y+'B'*z+'C'*x
        YZX.append((y, z, x))
YZX.sort(key=lambda x: (-x[0], -x[1], -x[2]))
y, z, x = YZX[0]
s = 'A'*y+'B'*z+'C'*x
print(s)
0