結果

問題 No.91 赤、緑、青の石
ユーザー springroll
提出日時 2018-11-18 20:47:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 1,901 ms
コンパイル使用メモリ 169,136 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 15:07:52
合計ジャッジ時間 3,241 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int c[3];

void debug();

int main() {
	
	cin >> c[0] >> c[1] >> c[2];

	int ans=0;
	/* 1つを0にする処理 */
	ans += min(c[0],min(c[1],c[2]));

	c[0] -= ans;
	c[1] -= ans;
	c[2] -= ans;

	/*debug();*/

	/* 石を交換する */
	int d;
	sort(c, c+3);
	d = c[2]-c[1];
	d /= 2;
	c[2] -= d*2;
	c[0] = d;

	/*debug();*/
	int m= min(c[0], min(c[1], c[2]));
	/*cout << m << endl;*/
	ans += m;

	c[0] -= m;
	c[1] -= m;
	c[2] -= m;

	/*debug();*/

	int d1,d2;
	d1 = c[1]/2; d2=c[2]/2;
	d1 /= 2; d2 /= 2;
	c[1] -= d1*2; c[2] -= d2*2;
	c[0] = d1+d2;

	int m2 = min(c[0], min(c[1], c[2]));
	/*cout << m2 << endl;*/
	ans += m2;

	c[0] -= m2;
	c[1] -= m2;
	c[2] -= m2;

	/*debug();*/
	cout << ans << endl;
}

void debug() {
	cout << c[0] << " " << c[1] << " " << c[2] << endl;
}
0