結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
|
提出日時 | 2016-09-22 21:22:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 70,536 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:00:20 |
合計ジャッジ時間 | 1,775 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <iostream>#include <algorithm>#include <array>#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)using namespace std;int main() {array<int,3> a; repeat (i,3) cin >> a[i]; whole(sort, a);int ans = 0;ans += a[0];a[2] -= a[0];a[1] -= a[0];a[0] = 0;while (a[1] >= 1 and a[2] >= 3) {ans += 1;a[1] -= 1;a[2] -= 3;if (a[1] > a[2]) swap(a[1], a[2]);}ans += a[2] / 5;a[2] %= 5;cout << ans << endl;return 0;}