結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2019-04-27 19:25:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 48 ms / 5,000 ms |
コード長 | 894 bytes |
コンパイル時間 | 735 ms |
コンパイル使用メモリ | 76,172 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:19:23 |
合計ジャッジ時間 | 2,106 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <string> #include <queue> #include <stack> #include <math.h> #include <set> #include <cstdio> #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define P pair<int, int> #define MOD 1000000007 #define INF 1012345678 #define NINF (-2147483647-1) #define LLINF 9223372036854775807 using ll = long long; using namespace std; int main() { vector<int> RGB(3); int ans = 0; cin >> RGB[0] >> RGB[1] >> RGB[2]; sort(ALL(RGB)); ans += RGB[0]; for (int i = 2; i >= 0; i--) { RGB[i] -= RGB[0]; } while (RGB[2] >= 3 && RGB[1] >= 1) { RGB[2] -= 3; RGB[1] -= 1; ans++; sort(ALL(RGB)); } while (RGB[2] >= 5) { RGB[2] -= 5; ans++; } cout << ans << endl; getchar(); getchar(); return 0; }