結果

問題 No.920 あかあお
ユーザー Shawn stayC
提出日時 2020-06-01 00:14:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 1,610 ms
コンパイル使用メモリ 167,168 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-19 06:57:25
合計ジャッジ時間 2,253 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
	int r,b,w; cin>>r>>b>>w;
	
	if(w==0){
		if(r==0||b==0){
			cout << 0 << endl;
			return 0;
		} else {
			cout << min(r,b) << endl;
			return 0;
		}
	} else {
		int d=max(r,b)-min(r,b);
		if(d>=w){
			cout << min(r,b)+w << endl;
			return 0;
		} else {
			w=(w-d)/2;
			cout << max(r,b)+w << endl;
			return 0;
		}
	}	
}
0