結果

問題 No.91 赤、緑、青の石
ユーザー mmn15277198
提出日時 2021-02-11 21:08:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 787 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 74,140 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 07:31:42
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin() , a.end());
    int ans = a[0];
    a[1] -= a[0];
    a[2] -= a[0];
    a[0] = 0;
    int t = 10000000;
    //cout << a[0] << " : " << a[1] << " : " << a[2] << " : " << ans << endl;
    while(t--){
        if(a[2] >= 3 && a[1] >= 1){
            ans++;
            a[1] -= 1;
            a[2] -= 3;
        }else if(a[2] >= 5 && a[1] == 0){
            ans++;
            a[2] -= 5;
        }else{
            break;
        }
        sort(a.begin() , a.end());
        //cout << a[0] << " : " << a[1] << " : " << a[2] << " : " << ans << endl;
    }
    
    cout << ans << endl;
    return 0;
}

0