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