結果

問題 No.2298 yukicounter
ユーザー hiro71687k
提出日時 2023-05-15 14:58:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 3,484 ms
コンパイル使用メモリ 250,992 KB
最終ジャッジ日時 2025-02-13 00:40:11
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=14449999;
ll mod=998244353;
int main(){
    string s;
    cin >> s;
    string t="yukicoder";
    ll ans=0;
    ll x=0;
    for (ll i = 0; i < s.size(); i++)
    {
        bool ok=true;
        for (ll j = 0; j < t.size(); j++)
        {
            if (i+j>=s.size())
            {
                ok=false;
            }
            if (s[i+j]!=t[j])
            {
                ok=false;
                break;
            }
        }
        if (ok)
        {
            x+=1;
            ans=max(ans,x);
            i+=8;
        }else{
            x=0;
        }
    }
    cout << ans << endl;
}
0