結果

問題 No.91 赤、緑、青の石
ユーザー fiordfiord
提出日時 2015-05-23 12:50:05
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 684 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 57,892 KB
実行使用メモリ 11,844 KB
最終ジャッジ日時 2023-09-20 10:41:05
合計ジャッジ時間 13,291 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

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;
	while(r+g+b>=3){
		if(r==0){
			if(g>b){
				mi=min(g/3,b);
				cnt+=mi;	g-=mi*3;	b-=mi;
			}
			else{
				mi=min(g,b/3);
				cnt+=mi;	g-=mi;	b-=mi*3;
			}
		}
		else if(g==0){
			if(r>b){
				mi=min(r/3,b);
				cnt+=mi;	r-=mi*3;	b-=mi;
			}
			else{
				mi=min(r,b/3);
				cnt+=mi;	r-=mi;	b-=mi*3;
			}
		}
		else{
			if(r>g){
				mi=min(r/3,g);
				cnt+=mi;	r-=mi*3;	g-=mi;
			}
			else{
				mi=min(r,g/3);
				cnt+=mi;	r-=mi;	g-=mi*3;
			}
		}
	}
	cnt+=(r/5)+(g/5)+(b/5);
	cout<<cnt<<endl;
	return 0;
}
0