結果

問題 No.2738 CPC To F
ユーザー Kou0406
提出日時 2025-01-18 11:18:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 61,676 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-18 11:18:20
合計ジャッジ時間 1,566 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int n;
string s;

int main(){
    int i,j;
    scanf("%d",&n);
    cin>>s;
    i=0;
    j=0;
    while(i<s.length()){
        if(s.substr(i,5)=="CPCTF"){
            j++;
            i+=5;
        }else if(s.substr(i,7)=="CPCTCPC"){
            j++;
            i+=7;
        }else
            i++;
    }
    printf("%d\n",j);
    return 0;
}
0