結果
| 問題 |
No.91 赤、緑、青の石
|
| ユーザー |
|
| 提出日時 | 2015-02-28 19:53:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 538 ms |
| コンパイル使用メモリ | 57,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 00:27:48 |
| 合計ジャッジ時間 | 1,480 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 WA * 15 |
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int r, g, b;
cin >> r >> g >> b;
int made = min({r, g, b});
int ans = 0;
r -= made;
g -= made;
b -= made;
ans += made;
int x, y;
if (r == 0) {
x = g;
y = b;
} else {
x = r;
y = max(g, b);
}
if (x < y) {
swap(x, y);
}
do {
made = min(x / 3, y);
x -= 3 * made;
y -= made;
ans += made;
if (x < y) {
swap(x, y);
}
} while (made > 0);
ans += x / 5;
cout << ans << endl;
return 0;
}