結果
問題 |
No.2298 yukicounter
|
ユーザー |
![]() |
提出日時 | 2023-05-13 19:43:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 708 ms |
コンパイル使用メモリ | 69,624 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 11:19:47 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <iostream> #include <string> #include <vector> #define rep(i, n) for(i = 0; i < n; i++) using namespace std; int main() { int i, j; vector<int> pos; string s; cin >> s; int n = s.length(); string key = "yukicoder"; int ans = 0, score = 0; for (i = 0; i <= n - key.length(); ) { rep(j, key.length()) { if (s[i + j] != key[j]) break; } if (j == key.length()) { i += key.length(); score++; ans = max(ans, score); } else { i++; score = 0; } } ans = max(ans, score); cout << ans << endl; return 0; }