結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー 🍮かんプリン
提出日時 2019-04-27 19:25:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 894 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 566 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-07 12:33:33
合計ジャッジ時間 1,995 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>

#define MOD 1000000007
#define INF 1012345678
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;

int main() {
    vector<int> RGB(3);
    int ans = 0;
    cin >> RGB[0] >> RGB[1] >> RGB[2];
    sort(ALL(RGB));
    ans += RGB[0];
    for (int i = 2; i >= 0; i--) { RGB[i] -= RGB[0]; }
    while (RGB[2] >= 3 && RGB[1] >= 1) {
        RGB[2] -= 3;
        RGB[1] -= 1;
        ans++;
        sort(ALL(RGB));
    }
    while (RGB[2] >= 5) {
        RGB[2] -= 5;
        ans++;
    }
    cout << ans << endl;
    getchar(); getchar();
    return 0;
}
0