QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746183#9741. CCPCwsyear#WA 0ms3740kbC++20799b2024-11-14 13:45:052024-11-14 13:45:06

Judging History

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

  • [2024-11-14 13:51:34]
  • hack成功,自动添加数据
  • (/hack/1179)
  • [2024-11-14 13:45:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-11-14 13:45:05]
  • 提交

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 -= 4, p -= 1;
  cout << 1 + min(c / 2, p) << '\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

ABCDCPCPC

output:

1

result:

ok single line: '1'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3740kb

input:

CAAACPBCDEFGCHIJCKLPM

output:

1

result:

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