結果

問題 No.91 赤、緑、青の石
ユーザー koba-e964
提出日時 2015-06-07 16:13:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 55,244 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 06:48:35
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long ll;
int s[3];
bool ok(ll c) {
  ll q = 0;
  REP(j, 0, 3) {
    if (s[j] >= c) {
      q += (s[j] - c) / 2;
    } else {
      q += s[j] - c;
    }
  }
  return q >= 0;
}

int main(void){
  cin >> s[0] >> s[1] >> s[2];
  int c = 0;
  for (int i = 30; i >= 0; --i) {
    if (ok(c | 1 << i)) {
      c |= 1 << i;
    }
  }
  cout << c << endl;
}
0