結果
| 問題 |
No.2738 CPC To F
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-20 21:22:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 674 bytes |
| コンパイル時間 | 749 ms |
| コンパイル使用メモリ | 66,068 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 19:35:10 |
| 合計ジャッジ時間 | 1,516 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 17 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
// "CPCTF" の数を数える
int count_CPCTF = 0;
for (int i = 0; i < N - 4; ++i) {
if (S.substr(i, 5) == "CPCTF") {
++count_CPCTF;
// "CPCTF" を "-" に置換
S.replace(i, 5, "-----");
}
}
// "CPCTCPC" の数を数え、先ほど数えた数に加算
int count_CPCTCPC = 0;
for (int i = 0; i < N - 6; ++i) {
if (S.substr(i, 7) == "CPCTCPC") {
++count_CPCTCPC;
}
}
cout << count_CPCTF + count_CPCTCPC << endl;
return 0;
}