結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2024-10-16 15:19:25 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 489 bytes |
コンパイル時間 | 2,261 ms |
コンパイル使用メモリ | 74,312 KB |
実行使用メモリ | 41,728 KB |
最終ジャッジ日時 | 2024-10-16 15:19:35 |
合計ジャッジ時間 | 7,958 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 19 |
ソースコード
import java.util.*; import java.util.regex.*; public class Main { public static void main(String[] args) throws Exception { var sc = new Scanner(System.in); String line = sc.next(); var pattern = Pattern.compile("c.*w.*w"); var matcher = pattern.matcher(line); if(matcher.find()){ System.out.println(matcher.group().length()); }else{ System.out.println(-1); } } }