結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
|
提出日時 | 2020-04-12 04:27:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 758 ms |
コンパイル使用メモリ | 76,412 KB |
最終ジャッジ日時 | 2025-01-09 17:36:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> void solve() { std::vector<int> xs(3); for (auto& x : xs) std::cin >> x; std::sort(xs.begin(), xs.end()); int d = xs[0]; int ans = d; for (auto& x : xs) x -= d; while (xs[1] >= 1 && xs[2] >= 3) { ++ans; xs[1] -= 1; xs[2] -= 3; if (xs[1] > xs[2]) std::swap(xs[1], xs[2]); } ans += xs[2] / 5; std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }