結果
| 問題 |
No.91 赤、緑、青の石
|
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-06-29 12:58:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 5,000 ms |
| コード長 | 772 bytes |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 91,408 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 07:07:28 |
| 合計ジャッジ時間 | 2,193 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#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(){
ll rgb[3];
FOR (i,0,3) cin >> rgb[i];
sort(rgb, rgb + 3);
ll ans = rgb[0];
FOR (i,0,3) rgb[i] -= ans;
while (rgb[0] + rgb[1] + rgb[2] >= 4) {
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;
}
if(rgb[2] >= 0)ans++;
sort(rgb, rgb + 3);
}
cout << ans << endl;
return 0;
}
nenuon