結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2014-12-09 08:01:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 695 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 41,544 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-11 18:48:31 |
合計ジャッジ時間 | 1,055 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 11 WA * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | int rgb[3];scanf("%d%d%d",&rgb[0],&rgb[1],&rgb[2]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector> #include <algorithm> using namespace std; //namaega184 int main(){ int rgb[3];scanf("%d%d%d",&rgb[0],&rgb[1],&rgb[2]); int ans; sort(rgb,rgb+3);ans=rgb[0]; for(int i=1;i<3;i++)rgb[i]-=rgb[0]; rgb[2]-=rgb[1]; if(rgb[1]==0){ ans+=rgb[2]/5; } else{ if((rgb[2]/2)<rgb[1]){ rgb[1]=rgb[1]-rgb[2]/2; if(rgb[1]<3)rgb[1]=0; ans+=rgb[2]/2+(rgb[1]>2?((int)(rgb[1]/2-(rgb[1]%2+rgb[1]%2<2)+rgb[2]/2%2)/2+((int)(rgb[1]%2+rgb[2]>1)+rgb[1]/2%2)/2):0); } else{ ans+=rgb[1]; rgb[2]-=rgb[1]*2; ans+=rgb[2]/5; } } printf("%d\n",ans); return 0; }