結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-07 20:12:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 5,000 ms |
| コード長 | 393 bytes |
| 記録 | |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 51,244 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:20:17 |
| 合計ジャッジ時間 | 2,329 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d%d",&v[0],&v[1],&v[2]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
vector<int>v(3);
scanf("%d%d%d",&v[0],&v[1],&v[2]);
sort(v.begin(),v.end());
int r=0;
for(;;){
if(v[0]&&v[1]&&v[2]){
v[1]-=v[0];
v[2]-=v[0];
r+=v[0];
v[0]=0;
}else if(v[2]>=2){
v[0]=1,v[2]-=2;
}else break;
sort(v.begin(),v.end());
}
printf("%d\n",r);
}