結果
問題 |
No.1534 おなかがいたい
|
ユーザー |
![]() |
提出日時 | 2022-02-23 21:51:48 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 9,017 ms |
コンパイル使用メモリ | 357,616 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 14:23:28 |
合計ジャッジ時間 | 9,086 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 WA * 6 |
ソースコード
import std; void main() { string S = readln.chomp; auto r = regex(r"p.n"); auto T = S.splitter!(Yes.keepSeparators)(r); bool isOK = true; string a = "pon", b = "pain"; int res, num = -1; foreach (t; T) { if (t == a) ++num; else if (t == b && isOK) { res = max(res, num); isOK = false; } } if (res == 0) res = -1; res.writeln; }