結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2016-02-19 00:04:21 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 38 ms / 5,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 62,588 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 06:55:42 |
合計ジャッジ時間 | 1,889 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (int i = e-1; i >= s; i--)#define rrep(i,n) RREP(i,0,n)#define REP(i,s,e) for (int i = s; i < e; i++)#define rep(i,n) REP(i,0,n)int main() {int rgb[3], ans;rep (i,3) cin >> rgb[i];ans = *min_element(rgb,rgb+3);rep (i,3) rgb[i] -= ans;sort(rgb,rgb+3);while (rgb[2] >= 3) {rgb[2] -= 2;rgb[0]++;sort(rgb,rgb+3);if (rgb[0] > 0) {ans++;rep (i,3) rgb[i]--;}}cout << ans << endl;return 0;}