結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2018-12-08 17:53:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 41,908 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 07:17:15 |
合計ジャッジ時間 | 1,310 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
#include <stdio.h> #include <algorithm> using namespace std; int main() { int R,G,B; scanf ("%d %d %d",&R,&G,&B); int l = 0, r = 10000001; while (l + 1 < r){ int m = (l + r) / 2; int u = 0, v = 0; for (int x : {R,G,B}){ if (x - m < 0) u += m - x; else v += (x - m) / 2; } if (u <= v) l = m; else r = m; } printf ("%d\n",l); return 0; }