結果
| 問題 |
No.91 赤、緑、青の石
|
| ユーザー |
184
|
| 提出日時 | 2014-12-09 08:04:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 698 bytes |
| コンパイル時間 | 270 ms |
| コンパイル使用メモリ | 41,548 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-11 18:48:33 |
| 合計ジャッジ時間 | 1,029 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 7 |
コンパイルメッセージ
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?(rgb[1]/2-((int)(rgb[1]%2+rgb[2]%2<2)+rgb[1]/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;
}
184