結果
問題 | No.2298 yukicounter |
ユーザー |
![]() |
提出日時 | 2023-06-04 02:07:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 42,624 KB |
実行使用メモリ | 7,680 KB |
最終ジャッジ日時 | 2024-12-29 03:21:17 |
合計ジャッジ時間 | 2,108 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
/* -*- coding: utf-8 -*- * * 2298.cc: No.2298 yukicounter - yukicoder */ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 1000000; const int L = 9; const char t[] = "yukicoder"; /* typedef */ /* global variables */ char s[MAX_N + 4]; int dp[MAX_N + 1]; /* subroutines */ /* main */ int main() { scanf("%s", s); int n = strlen(s); int maxc = 0; for (int i = 0; i < n; i++) { if (s[i] == t[dp[i] % L]) { dp[i + 1] = dp[i] + 1; maxc = max(maxc, dp[i + 1] / L); } } printf("%d\n", maxc); return 0; }