結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2020-05-12 20:27:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 99 ms / 5,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 1,720 ms |
コンパイル使用メモリ | 172,636 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:26:26 |
合計ジャッジ時間 | 3,546 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { vector<int> V; for (int i = 0; i < 3; i++) { int a; cin >> a; V.push_back(a); } int ans = 0; while (V[0] + V[1] + V[2] >= 3) { sort(V.begin(), V.end()); if (V[0]) { ans += V[0]; V[1] -= V[0]; V[2] -= V[0]; V[0] = 0; } else { V[2] -= 2; V[0]++; } } cout << ans << endl; }