QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#750604#9741. CCPCJEdwardWA 0ms3656kbC++201.7kb2024-11-15 15:10:122024-11-15 15:10:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 15:10:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-11-15 15:10:12]
  • 提交

answer

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0), cin.tie(0)
#define int long long
#define endl '\n'
#define lowbit(x) (x & -x)
#define all(s) s.begin(), s.end()
#define pii pair<int,int>
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define here system("pause")
using namespace std;
template <class T>
inline void read(T &x){
	x = 0;
	char c = getchar();
	bool f = 0;
	for (; !isdigit(c); c = getchar()) f ^= (c == '-');
	for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
	x = f ? -x : x;
}
template <class T>
inline void write(T x){
	if (x < 0) putchar('-'), x = -x;
	if (x < 10) putchar(x + 48);
	else write(x / 10), putchar(x % 10 + 48);
}
template<typename T> void chkmin(T& lhs, const T& rhs) { lhs = lhs > rhs ? rhs : lhs; }
template<typename T> void chkmax(T& lhs, const T& rhs) { lhs = lhs < rhs ? rhs : lhs; }

const int N = 5e5 + 5;
const int mod = 1e9 + 7;
const int INF = 1e11 + 9;
const double eps = 1e-9;
const double Pi = acos(-1);
inline int pow(int a, int b, int p){ int res = 1%p; while(b){ if(b&1) res=res*a%p; a=a*a%p, b>>=1;} return res;}
inline int inv(int a, int p){ return pow(a,p-2,p)%p;}
mt19937 rnd(chrono::duration_cast<chrono::nanoseconds>(chrono::system_clock::now().time_since_epoch()).count());
int randint(int L, int R) {
	uniform_int_distribution<int> dist(L, R);
	return dist(rnd);
}
inline void sol(){
	string s;
	cin >> s;
	map<char, int> mp;
	for(auto c : s){
		if(c == 'C') mp[c]++;
		if(c == 'P') mp[c]++;
	}
	for(int i=0;i<=mp['P'];i++){
		if(mp['C'] >= 2 * i + 1) continue;
		cout << min(i, mp['P']) << endl;
		return ;
	}
}

signed main(){
	IOS;
	int tc = 1;
//	cin >> tc;
	while(tc--){
		sol();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3656kb

input:

ABCDCPCPC

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'