結果

問題 No.91 赤、緑、青の石
ユーザー hotpepsi
提出日時 2014-12-07 22:30:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 66,292 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 17:44:59
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 11 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cmath>

using namespace std;

int main(int argc, char *argv[])
{
	string s;
	int r, g, b;
	getline(cin, s);
	stringstream ss(s);
	ss >> r >> g >> b;
	int ans = min(r, min(g, b));
	int a[3] = { r - ans, g - ans, b - ans };
	sort(a, a + 3);
	int c = min(a[1], (a[2] - a[1]) / 2);
	ans += c;
	a[1] -= c;
	a[2] -= c * 3;
	int d = a[1] / 3;
	ans += d;
	a[1] -= d * 3;
	a[2] -= d * 3;
	ans += a[2] / 5;
	cout << ans << endl;
	return 0;
}
0