結果

問題 No.149 碁石の移動
ユーザー kikage
提出日時 2020-04-09 21:38:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 55,280 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 22:27:12
合計ジャッジ時間 1,271 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
    int AB[2][2],C,D;
    cin >> AB[0][0] >> AB[0][1] >> AB[1][0] >> AB[1][1];
    cin >> C >> D;
    if(AB[0][1]<=C){
        AB[1][1]+=AB[0][1];
        AB[1][0]+=C-AB[0][1];
        AB[0][0]-=C-AB[0][1];
        AB[0][1]-=AB[0][1];
    }else{
        AB[1][1]+=C;
        AB[0][1]-=C;
    }
    
    if(AB[1][0]<D){
        AB[0][0]+=AB[1][0];
        AB[0][1]+=D-AB[1][0];
        AB[1][1]-=D-AB[1][0];
        AB[1][0]-=AB[1][0];
    }else{
        AB[0][0]+=D;
        AB[1][0]-=D;
    }
    cout << AB[0][0] << endl;
    return 0;
}
0