結果

問題 No.91 赤、緑、青の石
ユーザー fiordfiord
提出日時 2015-05-23 22:45:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 58,716 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-20 10:55:31
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int r,g,b;	cin>>r>>g>>b;
	int mi=r;
	if(mi>g)	mi=g;
	if(mi>b)	mi=b;
	int cnt=mi;	r-=mi;	g-=mi;	b-=mi;
	mi=1;
	while(mi>0){
		if(r==0){
			if(g>b){
				mi=min(g/3,b);
				if(mi!=0)	cnt++;	g-=3;	b--;
				
			}
			else{
				mi=min(g,b/3);
				if(mi!=0)	cnt++;	g--;	b-=3;
			}
		}
		else if(g==0){
			if(r>b){
				mi=min(r/3,b);
				if(mi!=0)	cnt++;	r-=3;	b--;
			}
			else{
				mi=min(r,b/3);
				if(mi!=0)	cnt++;	r--;	b-=3;
			}
		}
		else{
			if(r>g){
				mi=min(r/3,g);
				if(mi!=0)	cnt++;	r-=3;	g--;
			}
			else{
				mi=min(r,g/3);
				if(mi!=0)	cnt++;	r--;	g-=3;
			}
		}
	}
	cnt+=(r/5)+(g/5)+(b/5);
	cout<<cnt<<endl;
	return 0;
}
0