結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー nemunemu
提出日時 2023-05-03 08:17:45
言語 C++14
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 409 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 355 ms
コンパイル使用メモリ 62,160 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-07 12:40:57
合計ジャッジ時間 1,356 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

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

    int maxnum = (R + G + B) / 3;
    int res;
    for (res = maxnum; res >= 0; --res) {
        int r = R - res;
        int g = G - res;
        int b = B - res;
        if (r > 0) r /= 2;
        if (g > 0) g /= 2;
        if (b > 0) b /= 2;
        if (r + g + b >= 0) break;
    }
    cout << res << endl;
}
0