結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2020-03-06 21:49:23 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | WA | - |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 2 ms
5,248 KB |
testcase_15 | AC | 2 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | WA | - |
testcase_19 | AC | 2 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 2 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 2 ms
5,248 KB |
testcase_26 | AC | 2 ms
5,248 KB |
testcase_27 | AC | 2 ms
5,248 KB |
testcase_28 | WA | - |
testcase_29 | AC | 2 ms
5,248 KB |
ソースコード
#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; }