結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2014-12-07 19:22:21 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 2,074 bytes |
コンパイル時間 | 882 ms |
コンパイル使用メモリ | 104,072 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 06:41:56 |
合計ジャッジ時間 | 2,092 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <bitset>#include <deque>#include <list>#include <map>#include <queue>#include <set>#include <stack>#include <vector>#include <algorithm>#include <functional>#include <iterator>#include <locale>#include <memory>#include <stdexcept>#include <utility>#include <string>#include <fstream>#include <ios>#include <iostream>#include <iosfwd>#include <iomanip>#include <istream>#include <ostream>#include <sstream>#include <streambuf>#include <complex>#include <numeric>#include <valarray>#include <exception>#include <limits>#include <new>#include <typeinfo>#include <cassert>#include <cctype>#include <cerrno>#include <cfloat>#include <climits>#include <cmath>#include <csetjmp>#include <csignal>#include <cstdlib>#include <cstddef>#include <cstdarg>#include <ctime>#include <cstdio>#include <cstring>#include <cwchar>#include <cwctype>using namespace std;static const double EPS = 1e-8;static const double PI = 4.0 * atan(1.0);static const double PI2 = 8.0 * atan(1.0);typedef long long ll;typedef unsigned long long ull;#define ALL(c) (c).begin(), (c).end()#define CLEAR(v) memset(v,0,sizeof(v))#define MP(a,b) make_pair((a),(b))#define REP(i,n) for(int i=0;i<(int)n;++i)#define ABS(a) ((a)>0?(a):-(a))template<class T> T MIN(const T& a, const T& b) { return a < b ? a : b; }template<class T> T MAX(const T& a, const T& b) { return a > b ? a : b; }template<class T> void MIN_UPDATE(T& a, const T& b) { if (a > b) a = b; }template<class T> void MAX_UPDATE(T& a, const T& b) { if (a < b) a = b; }int main() {std::ios::sync_with_stdio(false);int R, G, B;cin >> R >> G >> B;int answer = 0;while (R + G + B > 2) {if (R && G && B) {int add = MIN(R, MIN(G, B));answer += add;R -= add;G -= add;B -= add;}else {if (R < G) {swap(R, G);}if (G < B) {swap(G, B);}if (R < G) {swap(R, G);}R -= 2;B += 1;}}cout << answer << endl;}