結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2014-12-08 00:14:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 58 ms / 5,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 1,466 ms |
コンパイル使用メモリ | 161,928 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 06:45:50 |
合計ジャッジ時間 | 3,058 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <iostream> #include <bits/stdc++.h> using namespace std; //と思ったら僕がバカでしたごめんなさいリバーシのルールを忘れていましたごめんなさい int rec(vector<int> s){ sort(s.begin(),s.end()); if( s[0] == 0 ){ int c = 0; while( s[2] >= 3 && s[1] >= 1){ s[2]-= 3; s[1]--; sort(s.begin(),s.end()); c++; } return c + s[2] / 5; }else{ return s[0] + rec({0,s[1]-s[0],s[2]-s[0]}); } } int main(){ int R,G,B; cin >> R >> G >> B; cout << rec({R,G,B}) << endl; }