結果

問題 No.91 赤、緑、青の石
ユーザー eve__fuyuki
提出日時 2018-03-14 02:00:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 66,384 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 15:19:56
合計ジャッジ時間 1,563 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    vector<int> list;
    int input,min;
    int ans;
    for(int i=0;i<3;i++){
        cin >> input;
        list.push_back(input);
    }
    sort(list.begin(),list.end(),greater<int>());
    ans = list[2];
    list[0] -= list[2];
    list[1] -= list[2];
    list.pop_back();
    while(list[0] >= 3 && list[1] >= 1){
        min = list[0]/3;
        if(min > list[1]) min = list[1];
        ans += min;
        list[0] -= 3*min;
        list[1] -= min;
        sort(list.begin(),list.end(),greater<int>());
    }
    ans += list[0]/5;
    cout << ans << endl;
    return 0;
}
0