結果
| 問題 | 
                            No.2738 CPC To F
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-04-21 02:15:04 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 448 bytes | 
| コンパイル時間 | 2,362 ms | 
| コンパイル使用メモリ | 192,860 KB | 
| 最終ジャッジ日時 | 2025-02-21 07:41:42 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 7 WA * 15 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i + 4 < n) {
            if (s.substr(i, 5) == "CPCTF") {
                ans++;
            }
        }
        if (i + 6 < n) {
            if (s.substr(i, 7) == "CPCTCPC") {
                ans++;
                i += 7;
            }
        }
    }
    cout << ans << endl;
}