結果

問題 No.91 赤、緑、青の石
ユーザー しらっ亭
提出日時 2016-02-09 23:45:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 1,236 ms
コンパイル使用メモリ 159,468 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-21 22:02:28
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 18
権限があれば一括ダウンロードができます

ソースコード

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