結果
問題 |
No.2738 CPC To F
|
ユーザー |
![]() |
提出日時 | 2024-07-12 13:58:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 1,750 ms |
コンパイル使用メモリ | 166,540 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-12 13:58:08 |
合計ジャッジ時間 | 3,112 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int N; string s; cin >> N >> s; int i = 0, ans = 0; while(1) { auto p = s.find("CPCT", i); if(p == string::npos) break; int j = p; if(s.substr(j + 4, 3) == "CPC") { ans++; i = j + 7; } else if(s.substr(j + 4, 1) == "F") { ans++; i = j + 5; } else i = j + 4; } cout << ans << endl; }