結果
| 問題 | No.1005 BOT対策 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-06 21:54:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 425 bytes |
| 記録 | |
| コンパイル時間 | 1,940 ms |
| コンパイル使用メモリ | 194,876 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 00:48:19 |
| 合計ジャッジ時間 | 2,629 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
string s,t; cin>>s>>t;
int m=s.length(),n=t.length();
if(n==1){
if(count(s.begin(),s.end(),t[0])>0) return puts("-1"),0;
else return puts("0"),0;
}
if(m<n) return puts("0"),0;
int ans=0;
rep(i,m-n+1) if(s.substr(i,n)==t) {
i+=n-2;
ans++;
}
printf("%d\n",ans);
return 0;
}