結果

問題 No.2298 yukicounter
ユーザー Ritik RamanRitik Raman
提出日時 2023-05-12 22:12:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,038 bytes
コンパイル時間 1,706 ms
コンパイル使用メモリ 166,792 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 12:13:34
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 5 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 TLE -
testcase_23 AC 9 ms
5,376 KB
testcase_24 AC 40 ms
5,376 KB
testcase_25 AC 19 ms
5,376 KB
testcase_26 AC 7 ms
5,376 KB
testcase_27 AC 31 ms
5,376 KB
testcase_28 AC 7 ms
5,376 KB
testcase_29 AC 6 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 5 ms
5,376 KB
testcase_32 AC 7 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define  ma 1000000007
#define ll long long int
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main() {
	io
	string S;
    cin >> S ;
    string P="yukicoder";


    int n = S.length(), m = P.length();
    int ans = 0;

    for (int i = 0; i <= n-m; i++) {
        bool ok = true;
        for (int j = 0; j < m; j++) {
            if (S[i+j] != P[j]) {
                ok = false;
                break;
            }
        }
        if (ok) {
            int cnt = 1;
            for (int j = i+m; j <= n-m; j += m) {
                bool ok2 = true;
                for (int k = 0; k < m; k++) {
                    if (S[j+k] != P[k]) {
                        ok2 = false;
                        break;
                    }
                }
                if (ok2) {
                    cnt++;
                } else {
                    break;
                }
            }
            ans = max(ans, cnt);
        }
    }

    cout << ans << endl;
	return 0;
}
0