結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-11 09:48:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 614 bytes |
| コンパイル時間 | 1,862 ms |
| コンパイル使用メモリ | 195,516 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 00:52:20 |
| 合計ジャッジ時間 | 2,414 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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