結果

問題 No.149 碁石の移動
ユーザー 村上史弥村上史弥
提出日時 2022-11-27 15:19:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-14 23:04:43
合計ジャッジ時間 1,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 30 ms
10,880 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 30 ms
10,880 KB
testcase_14 AC 31 ms
10,752 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 30 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A = list(map(int, input().split()))
B = list(map(int, input().split()))
CD = list(map(int, input().split()))

Aw = A[0]
Ab = A[1]
Bw = B[0]
Bb = B[1]

if CD[0] <= Ab:
    Ab -= CD[0]
    Bb += CD[0]
elif CD[0] > Ab:
    Aw -= (CD[0] - Ab)
    Bw += (CD[0] - Ab)
    if not Ab == 0:
        Bb += (CD[0] - Ab)
    Ab = 0

if CD[1] <= Bw:
    Aw += CD[1]
    Bw -= CD[1]
elif CD[1] > Bw:
    Aw += Bw
    Bb -= (CD[1] - Bw)
    if not Bw == 0:
        Ab += (CD[1] - Bw)
    Bw = 0

print(Aw)
0