QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#1179 | #746195 | #9741. CCPC | wsyear | wsyear | Success! | 2024-11-14 13:51:21 | 2024-11-14 13:51:22 |
Details
Extra Test:
Wrong Answer
time: 0ms
memory: 3604kb
input:
CCPC
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#746195 | #9741. CCPC | wsyear# | WA | 2ms | 4180kb | C++20 | 799b | 2024-11-14 13:48:09 | 2024-11-14 13:51:41 |
answer
#include <bits/stdc++.h>
#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }
using namespace std;
int main() {
cin.tie(nullptr) -> ios::sync_with_stdio(false);
string str;
cin >> str;
int c = 0, p = 0;
for (char x : str) {
if (x == 'C') c++;
if (x == 'P') p++;
}
if (c < 4 || p < 1) return cout << "0\n", 0;
c -= 3, p -= 1;
cout << 1 + min(c / 2, p) << '\n';
}