結果
| 問題 | No.2298 yukicounter |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-12 21:40:40 |
| 言語 | D (dmd 2.113.0) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,030 bytes |
| 記録 | |
| コンパイル時間 | 2,889 ms |
| コンパイル使用メモリ | 172,096 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-14 00:19:51 |
| 合計ジャッジ時間 | 5,507 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 1 |
ソースコード
import std;
void main () {
string S = readln.split[0];
solve(S);
}
void solve (string S) {
int ans = 0;
while ("yukicoder".length <= S.length) {
if (S[0] == 'y') {
auto tmp = HowMany_included(S, "yukicoder");
ans = tmp > ans ? tmp : ans;
} else {
S = S[1..$];
}
}
writeln(ans);
}
int HowMany_included (ref string base, string key) {
if (base.length < key.length) {
return 0;
}
int ret = 0;
while (key.length <= base.length) {
bool is_included = true;
int cut = -1;
foreach (j; 0..key.length) {
if (base[j] != key[j]) {
is_included = false;
cut = cast(int)j;
break;
}
}
if (cut == -1) {
base = base[9..$];
} else {
base = base[cut + 1..$];
}
if (is_included) {
ret++;
} else {
return ret;
}
}
return ret;
}