結果

問題 No.91 赤、緑、青の石
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-18 05:45:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 451 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 51,396 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 12:21:23
合計ジャッジ時間 1,958 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
4,376 KB
testcase_01 AC 15 ms
4,376 KB
testcase_02 AC 10 ms
4,380 KB
testcase_03 AC 19 ms
4,376 KB
testcase_04 AC 10 ms
4,376 KB
testcase_05 AC 23 ms
4,380 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 17 ms
4,376 KB
testcase_13 AC 19 ms
4,380 KB
testcase_14 AC 13 ms
4,380 KB
testcase_15 AC 24 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 29 ms
4,380 KB
testcase_26 AC 28 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 4 ms
4,376 KB
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 21 ms
4,376 KB
testcase_31 AC 28 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using namespace std;

int main(){

	long long RGB[3];

	cin>>RGB[0]>>RGB[1]>>RGB[2];

	while(1){
		int max_i=0,min_i;
		for(int i=1;i<3;i++){
			if(RGB[i]>RGB[max_i]) max_i=i;
		}
		if(max_i==0) min_i=1;
		else min_i=0;
		for(int i=0;i<3;i++){
			if(max_i==i) continue;
			if(RGB[i]<RGB[min_i]) min_i=i;
		}
		if(RGB[max_i]-RGB[min_i]<=1) break;
		RGB[max_i]-=2;
		RGB[min_i]+=1;
	}

	cout<<min(RGB[0],min(RGB[1],RGB[2]))<<endl;

}
0