QOJ.ac

QOJ

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#1179#746195#9741. CCPCwsyearwsyearSuccess!2024-11-14 13:51:212024-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'

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746195#9741. CCPCwsyear#WA 2ms4180kbC++20799b2024-11-14 13:48:092024-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';
}