結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-03-05 23:30:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 562 bytes |
| コンパイル時間 | 341 ms |
| コンパイル使用メモリ | 51,092 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 08:20:45 |
| 合計ジャッジ時間 | 1,078 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | int g,c,p;char s[501];scanf("%d%d%d%s",&g,&c,&p,s);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int g,c,p;char s[501];scanf("%d%d%d%s",&g,&c,&p,s);
int gg=0,cc=0,pp=0;
int len=strlen(s);
int ans=0;
for(int i=0;i<len;i++){
if(s[i]=='G')gg++;
else if(s[i]=='C')cc++;
else pp++;
}
int tmp=min(p,gg);
ans+=tmp*3;
p-=tmp;
tmp=min(g,cc);
ans+=tmp*3;
g-=tmp;
tmp=min(c,pp);
ans+=tmp*3;
c-=tmp;
printf("%d\n",ans+min(g,gg)+min(p,pp)+min(c,cc));
return 0;
}
184