結果
| 問題 |
No.91 赤、緑、青の石
|
| ユーザー |
184
|
| 提出日時 | 2014-12-08 20:41:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 604 bytes |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 41,168 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 18:29:43 |
| 合計ジャッジ時間 | 1,192 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 13 WA * 15 |
コンパイルメッセージ
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;
ans+=rgb[2]/2+rgb[1]>2?(rgb[1]/2-(rgb[1]%2+rgb[2]%2)/2):0;
}
else{
ans+=rgb[1];
rgb[2]-=rgb[1]*2;
ans+=rgb[2]/5;
}
}
printf("%d\n",ans);
return 0;
}
184