結果

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;
typedef long long LL;

int main(){
    int r, g, b;
    cin >> r >> g >> b;
    int ans = 0;
    for(int i = 1; i <= 10000000; i++){
        int over = max(0, r-i)/2 + max(0, g-i)/2 + max(0, b-i)/2;
        int short_cnt = max(0, i-r) + max(0, i-g) + max(0, i-b);
        if(over >= short_cnt) ans = i;
    }
    cout << ans << endl;
    return 0;
}
0