結果

問題 No.91 赤、緑、青の石
ユーザー h_nosonh_noson
提出日時 2016-02-19 00:04:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 609 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 62,716 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 12:18:39
合計ジャッジ時間 2,297 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
4,376 KB
testcase_01 AC 28 ms
4,376 KB
testcase_02 AC 18 ms
4,380 KB
testcase_03 AC 33 ms
4,376 KB
testcase_04 AC 16 ms
4,376 KB
testcase_05 AC 39 ms
4,380 KB
testcase_06 AC 12 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 12 ms
4,380 KB
testcase_12 AC 35 ms
4,380 KB
testcase_13 AC 38 ms
4,376 KB
testcase_14 AC 27 ms
4,376 KB
testcase_15 AC 40 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 64 ms
4,380 KB
testcase_26 AC 59 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 7 ms
4,376 KB
testcase_29 AC 12 ms
4,376 KB
testcase_30 AC 43 ms
4,380 KB
testcase_31 AC 57 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (int i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)

int main() {
    int rgb[3], ans;
    rep (i,3) cin >> rgb[i];
    ans = *min_element(rgb,rgb+3);
    rep (i,3) rgb[i] -= ans;
    sort(rgb,rgb+3);
    while (rgb[2] >= 3) {
        rgb[2] -= 2;
        rgb[0]++;
        sort(rgb,rgb+3);
        if (rgb[0] > 0) {
            ans++;
            rep (i,3) rgb[i]--;
        }
    }
    cout << ans << endl;
    return 0;
}
0