結果
| 問題 | No.1005 BOT対策 |
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-11 09:48:07 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 301µs | |
| コード長 | 614 bytes |
| 記録 | |
| コンパイル時間 | 1,352 ms |
| コンパイル使用メモリ | 214,120 KB |
| 実行使用メモリ | 9,408 KB |
| 最終ジャッジ日時 | 2026-07-12 08:24:48 |
| 合計ジャッジ時間 | 2,910 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::string s,t;std::cin>>s>>t;
lint l=s.length(),m=t.length();
if(m==1&&std::find(ALL(s),t.front())!=s.end()){
std::cout<<-1<<'\n';
return 0;
}
lint ans=0;
for(lint i=0;i<l;){
if(s.substr(i,m)==t){
i+=m-1;
ans++;
}else{
i++;
}
}
std::cout<<ans<<'\n';
}
ngtkana