結果

問題 No.501 穴と文字列
ユーザー けむけむけむけむ
提出日時 2021-08-14 15:15:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-15 13:13:43
合計ジャッジ時間 2,176 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
11,008 KB
testcase_01 AC 38 ms
10,880 KB
testcase_02 AC 35 ms
10,752 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 35 ms
10,752 KB
testcase_05 AC 34 ms
10,752 KB
testcase_06 AC 34 ms
10,752 KB
testcase_07 AC 35 ms
10,752 KB
testcase_08 AC 38 ms
10,752 KB
testcase_09 AC 35 ms
10,880 KB
testcase_10 AC 34 ms
10,752 KB
testcase_11 AC 37 ms
10,752 KB
testcase_12 AC 38 ms
10,752 KB
testcase_13 AC 36 ms
10,752 KB
testcase_14 AC 33 ms
10,880 KB
testcase_15 AC 34 ms
10,880 KB
testcase_16 AC 34 ms
10,752 KB
testcase_17 AC 32 ms
10,752 KB
testcase_18 AC 33 ms
10,880 KB
testcase_19 AC 41 ms
10,752 KB
testcase_20 AC 49 ms
10,880 KB
testcase_21 AC 47 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ana(N, D):
    if D == 0:
        S = 'C' * N
        return S
    else:
        for i in range(N + 1):
            a = N - i
            if (2 * N - D - a >= 0) and (D - a >= 0) and ((2 * N - D - a) % 2 == 0) and ((D - a) % 2 == 0):
                b = (D - a) // 2
                c = (2 * N - D - a) // 2
                break
        S = 'A' * a + 'B' * b + 'C' * c
        return S

def main():
    N, D = map(int, input().split())
    print(ana(N, D))

if __name__ == '__main__':
    main()
0