結果
| 問題 |
No.91 赤、緑、青の石
|
| コンテスト | |
| ユーザー |
めうめう🎒
|
| 提出日時 | 2016-03-30 09:49:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 725 ms |
| コンパイル使用メモリ | 72,664 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 06:57:17 |
| 合計ジャッジ時間 | 1,775 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
int main() {
int r,g,b,ans = 0;
cin >> r >> g >> b;
int m;
while(true){
m = min(r,min(g,b));
ans += m;
r -= m,g -= m,b -= m;
if(g <= r && b <= r){
if(r > 2) r-= 2;
else break;
}else if(r <= g && b <= g){
if(g > 2) g -= 2;
else break;
}else{
if(b > 2) b -= 2;
else break;
}
if(r == 0){
r += 1;
}else if(g == 0){
g += 1;
}else{
b += 1;
}
}
cout << ans << endl;
return 0;
}
めうめう🎒