結果

問題 No.149 碁石の移動
ユーザー KuraKura
提出日時 2019-07-13 13:18:01
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 157,528 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 19:46:02
合計ジャッジ時間 2,161 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include"bits/stdc++.h"
using namespace std;
int main() {
	int asi, aku, bsi, bku, ab, ba; cin >> asi >> aku >> bsi >> bku >> ab >> ba;
	int ans = 0;
	if (aku >= ab) {
		ans += asi;
		if (bsi >= ba)ans += ba;
		else ans += bsi;
	}
	else {
		ans += asi + aku - ab;
		if (ab - aku + bsi >= ba)ans += ba;
		else ans += ab - aku + bsi;
	}
	cout << ans << endl;
}
0