結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー kanpurin002
提出日時 2018-11-15 17:57:29
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 156 ms
コンパイル使用メモリ 38,212 KB
最終ジャッジ日時 2026-02-22 02:06:50
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main() {
	int r,g,b,min,max,count=0;
	scanf("%d%d%d",&r,&g,&b);
	min=r>g?(g>b?b:g):(r>b?b:r);
	r-=min;g-=min;b-=min;count+=min;
	do {
		max=r<g?(g<b?b:g):(r<b?b:r);
		if (max>=3) {
			if (r<g) {
				if (g<b) b-=2;
				else g-=2;
			} else {
				if (r<b) b-=2;
				else r-=2;
			}
			if (r>g) {
				if (g>b) b+=1;
				else g+=1;
			} else {
				if (r>b) b+=1;
				else r+=1;
			}
			r-=1;g-=1;b-=1;count+=1;
		}
	} while (max>=3);
	printf("%d\n",count);
    return 0;
}
0