結果
問題 | No.345 最小チワワ問題 |
ユーザー | yuikibis |
提出日時 | 2016-02-28 22:04:08 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 657 bytes |
コンパイル時間 | 2,268 ms |
コンパイル使用メモリ | 74,936 KB |
実行使用メモリ | 57,768 KB |
最終ジャッジ日時 | 2023-10-24 18:50:35 |
合計ジャッジ時間 | 7,317 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
57,364 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 109 ms
56,192 KB |
testcase_08 | AC | 122 ms
57,520 KB |
testcase_09 | AC | 123 ms
57,496 KB |
testcase_10 | AC | 120 ms
57,448 KB |
testcase_11 | AC | 125 ms
57,572 KB |
testcase_12 | AC | 125 ms
57,180 KB |
testcase_13 | AC | 114 ms
56,196 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 125 ms
57,448 KB |
testcase_21 | AC | 123 ms
57,316 KB |
testcase_22 | AC | 123 ms
57,560 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 113 ms
56,000 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 123 ms
57,184 KB |
ソースコード
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String text = scanner.next(); Pattern p = Pattern.compile("c.*w.*w"); Matcher m = p.matcher(text); int length = Integer.MAX_VALUE; while (m.find()) { int matched = m.group().length(); if (length > matched) { length = matched; } } if (length == Integer.MAX_VALUE) { length = -1; } System.out.println(length); } }