QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#746183 | #9741. CCPC | wsyear# | WA | 0ms | 3740kb | C++20 | 799b | 2024-11-14 13:45:05 | 2024-11-14 13:45:06 |
Judging History
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'