結果
問題 | No.2298 yukicounter |
ユーザー |
![]() |
提出日時 | 2023-05-13 16:05:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 1,602 ms |
コンパイル使用メモリ | 166,228 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 08:22:15 |
合計ジャッジ時間 | 2,985 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool chmax(int& a,int b){if(a<b){a=b; return 1;} return 0;} int main(){ string s; cin >> s; int sz = s.size(); string yuki = "yukicoder"; int cnt = 0; int now = 0; int ans = 0; for(int i=0;i<sz;i++) { if(s[i] == yuki[now]) now++; else { cnt = 0; now = 0; } if(now==(int)yuki.size()) { now=0; cnt++; } chmax(ans,cnt); } cout << ans << endl; return 0; }