結果

問題 No.149 碁石の移動
ユーザー kichirb3
提出日時 2018-03-05 12:20:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-19 18:46:38
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.149 碁石の移動
https://yukicoder.me/problems/no/149

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    Aw, Ab = map(int, input().split())
    Bw, Bb = map(int, input().split())
    C, D = map(int, input().split())

    # C個の移動
    if C <= Ab:
        Bb += C
        Ab -= C
    else:
        Bb += Ab
        Aw -= (C - Ab)
        Bw += (C - Ab)
        Ab = 0

    # D個の移動
    if D <= Bw:
        Aw += D
        Bw -= D
    else:
        Aw += Bw

    print(Aw)


if __name__ == '__main__':
    main(sys.argv[1:])
0