結果

問題 No.91 赤、緑、青の石
ユーザー しらっ亭しらっ亭
提出日時 2016-02-09 23:45:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 1,263 ms
コンパイル使用メモリ 160,028 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 20:37:03
合計ジャッジ時間 2,300 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
typedef long long ll;
// -------------------------------------

int count(int a, int b, int c) {
  //_P("%d,%d,%d\n", a,b,c);
  int ma = max({a, b, c});
  int mi = min({a, b, c});
  int mu = a + b + c - ma - mi;


  ma -= mi;
  mu -= mi;

  int ans = mi;

  if (ma >= 3) ans += count(ma - (ma / 3) * 2, mu, ma / 3);

  return ans;
}

int main() {
  int R, G, B;
  cin >> R >> G >> B;

  int ans = count(R, G, B);

  cout << ans << endl;

  return 0;
}
0