結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2017-07-10 13:53:41 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 360 bytes |
コンパイル時間 | 9,074 ms |
コンパイル使用メモリ | 298,464 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 20:48:35 |
合計ジャッジ時間 | 9,986 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 15 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.regex; // RegEx void main() { auto s = readln.chomp; auto r = 0; while (s.length >= 3) { if (s[0] == 'c') { auto m = s.matchFirst(r"^c[^w]*?w[^w]*?w"); if (!m.empty) r = max(r, m[0].length.to!int); } s = s[1..$]; } writeln(r == 0 ? -1 : r); }