結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-16 12:57:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 537 bytes |
| コンパイル時間 | 2,008 ms |
| コンパイル使用メモリ | 193,400 KB |
| 最終ジャッジ日時 | 2025-01-15 07:47:53 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int g,c,p; cin >> g >> c >> p;
int gg=0,cc=0,pp=0;
string s; cin >> s;
for(char c:s){
if(c=='C')cc++;
else if(c=='G')gg++;
else pp++;
}
int res=0;
int a=min(g,cc);
res+=a*3; g-=a; cc-=a;
a=min(c,pp);
res+=3*a; c-=a; pp-=a;
a=min(p,gg);
res+=3*a; p-=a; gg-=a;
res+=min(g,gg)+min(p,pp)+min(c,cc);
cout << res << endl;
}