結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
Hasegawa_frog
|
| 提出日時 | 2020-03-06 21:49:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 737 bytes |
| コンパイル時間 | 1,647 ms |
| コンパイル使用メモリ | 167,320 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 10:32:33 |
| 合計ジャッジ時間 | 3,098 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 5 RE * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
const long double PI = acos(-1);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
int main(){
string s, t;
cin >> s >> t;
ll tlen = t.size();
ll ans = 0;
for(ll i = 0; i < s.size()-tlen + 1; i++){
string s2 = s.substr(i, tlen);
//cout << i << endl;
if(s2 == t && tlen > 1) {
ans++;
i += tlen-1;
}else if(tlen == 1) {
cout << -1 << endl;
return 0;
}
}
cout << ans << endl;
return 0;
}
Hasegawa_frog