結果

問題 No.149 碁石の移動
ユーザー kongarishisyamo
提出日時 2016-03-01 05:44:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 56,280 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 03:15:06
合計ジャッジ時間 1,175 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>

using namespace std;

#define NMAX 100000

int main(){

	int Aw,Ab,Bw,Bb;
	int C,D;

	cin>>Aw>>Ab;
	cin>>Bw>>Bb;
	cin>>C>>D;

	if(Ab<C) Aw-=(C-Ab),Bw+=(C-Ab),Bb+=Ab;
	else Bb+=C,Ab-=C;
	if(Bw<=D) Aw+=Bw,Ab+=(D-Bw),Bw=0,Bb-=(D-Bb);
	else Aw+=D,Bw-=D;

	cout<<Aw<<endl;

}
0