結果

問題 No.91 赤、緑、青の石
ユーザー springrollspringroll
提出日時 2018-11-18 20:47:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 1,743 ms
コンパイル使用メモリ 167,336 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-26 02:00:04
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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