結果
| 問題 |
No.91 赤、緑、青の石
|
| コンテスト | |
| ユーザー |
Ysmr_Ry
|
| 提出日時 | 2014-12-24 14:04:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 479 ms |
| コンパイル使用メモリ | 33,628 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 06:46:38 |
| 合計ジャッジ時間 | 1,454 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf( "%d%d%d", &R, &G, &B );
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio>
#include<algorithm>
#define rep(i,a) for(int i=0;i<(a);++i)
int R, G, B;
bool C( int n )
{ return (std::max(0,R-n)>>1)+(std::max(0,G-n)>>1)+(std::max(0,B-n)>>1) >= std::max(0,n-R)+std::max(0,n-G)+std::max(0,n-B); }
int main()
{
scanf( "%d%d%d", &R, &G, &B );
int lb = 0, ub = R+G+B+1;
while( ub-lb > 1 )
{
int mid = (lb+ub)>>1;
(C(mid)?lb:ub) = mid;
}
printf( "%d\n", lb );
return 0;
}
Ysmr_Ry