結果

問題 No.91 赤、緑、青の石
ユーザー nenuon
提出日時 2017-06-29 12:47:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 90,944 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 16:32:59
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 25 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main(){
  int rgb[3];
  FOR (i,0,3) cin >> rgb[i];
  sort(rgb, rgb + 3);
  int ans = rgb[0];
  FOR (i,0,3) rgb[i] -= ans;
  while (rgb[0] + rgb[1] + rgb[2] >= 5) {
    int need = 0;
    FOR (i,0,3) if(rgb[i] == 0) need++;
    if(need == 2) {
      rgb[2] -= 5;
    } else if (need == 1) {
      rgb[2] -= 3;
      rgb[1] -= 1;
    }
    ans++;
    sort(rgb, rgb + 3);
  }
  cout << ans << endl;
  return 0;
}
0