結果
問題 | No.1005 BOT対策 |
ユーザー | fura |
提出日時 | 2020-03-06 21:54:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 2,233 ms |
コンパイル使用メモリ | 194,240 KB |
最終ジャッジ日時 | 2025-01-09 05:04:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#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; }