結果

問題 No.91 赤、緑、青の石
ユーザー fine
提出日時 2016-03-26 00:43:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 491 bytes
コンパイル時間 1,301 ms
コンパイル使用メモリ 160,080 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-24 06:57:06
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int stone[3], ans = 0, tmp;
    cin >> stone[0] >> stone[1] >> stone[2];
    sort(stone, stone + 3);
    stone[2] -= stone[0];
    stone[1] -= stone[0];
    for(int i = 0; i <= stone[1] / 3; i++) {
        tmp = min(stone[1] - 3 * i, (stone[2] - i) / 3);
        tmp = tmp + i + (stone[1] - tmp - 3 * i) / 5 + (stone[2] - i - 3 * tmp) / 5;
        ans = max(ans, tmp);
    }
    cout << ans + stone[0] << endl;
    return 0;
}
0