結果
| 問題 | No.2738 CPC To F |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-18 11:04:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 725 bytes |
| 記録 | |
| コンパイル時間 | 894 ms |
| コンパイル使用メモリ | 61,952 KB |
| 実行使用メモリ | 14,336 KB |
| 最終ジャッジ日時 | 2025-01-18 11:05:55 |
| 合計ジャッジ時間 | 68,579 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | TLE * 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);
| ~~~~~^~~~~~~~~
ソースコード
#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;
string ss;
i=0;
while(i<n){
if(s.substr(i,3)=="CPC"){
ss.push_back('X');
i+=3;
}else{
ss.push_back(s[i]);
i++;
}
}
i=0;
j=0;
while(i<ss.length()){
if(i+1<ss.length()&&ss[i]=='X'&&ss[i+1]=='T'){
if(i+2<ss.length()&&(ss[i+2]=='F'||ss[i+2]=='X')){
j++;
i+=3;
}
}else
i++;
}
printf("%d\n",j);
return 0;
}