結果

問題 No.2738 CPC To F
ユーザー rotti_coder
提出日時 2024-04-20 10:06:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 70,028 KB
最終ジャッジ日時 2025-02-21 06:05:35
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  string s,t="CPCTF";
  cin >> n >> s;
  int ans=0;
  int cnt=0;
  for(int i=0;i<n;i++){
    if(s[i]==t[cnt])cnt++;
    else if(cnt==4 && i+2<n){
      if(s[i]=='C' && s[i+1]=='P' && s[i+2]=='C'){
	ans++;
	cnt=0;
	i+=2;
      }
    }
    else cnt=0;
    if(cnt==5){
      ans++;
      cnt=0;
    }
  }
  cout << ans << endl;
}
0