結果

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

テストケース

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

ソースコード

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(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;
			}
		}
		if(mi==0)	break;
	}
	cnt+=(r/5)+(g/5)+(b/5);
	cout<<cnt<<endl;
	return 0;
}
0