結果

問題 No.1005 BOT対策
ユーザー kpinkcat
提出日時 2023-08-24 17:49:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 101,276 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 01:43:15
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    string s, t;
    cin >> s >> t;
    int ls = s.size(), lt = t.size(), cnt = 0;
    for (int i = 0; i < ls - lt + 1; i++){
        string temp = s.substr(i, lt);
        if (temp == t){
            cnt++;
            if (lt != 2) i += lt -1;
        }
    }
    cout << ((lt == 1 && cnt != 0) ? -1 : cnt) << endl;
}
0