結果
問題 | No.342 一番ワロタww |
ユーザー | ぴろず |
提出日時 | 2016-02-13 00:44:26 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 118 ms / 5,000 ms |
コード長 | 854 bytes |
コンパイル時間 | 1,898 ms |
コンパイル使用メモリ | 79,020 KB |
実行使用メモリ | 54,504 KB |
最終ジャッジ日時 | 2024-04-23 13:18:28 |
合計ジャッジ時間 | 4,362 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
53,032 KB |
testcase_01 | AC | 99 ms
54,504 KB |
testcase_02 | AC | 110 ms
53,600 KB |
testcase_03 | AC | 103 ms
52,700 KB |
testcase_04 | AC | 98 ms
52,376 KB |
testcase_05 | AC | 111 ms
53,844 KB |
testcase_06 | AC | 105 ms
52,948 KB |
testcase_07 | AC | 94 ms
52,604 KB |
testcase_08 | AC | 98 ms
52,992 KB |
testcase_09 | AC | 103 ms
52,708 KB |
testcase_10 | AC | 111 ms
54,256 KB |
testcase_11 | AC | 114 ms
54,140 KB |
testcase_12 | AC | 110 ms
53,688 KB |
testcase_13 | AC | 104 ms
52,756 KB |
testcase_14 | AC | 102 ms
53,108 KB |
testcase_15 | AC | 118 ms
54,240 KB |
testcase_16 | AC | 113 ms
54,136 KB |
ソースコード
package no342; import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static final char kusa = 'w'; public static void main(String[] args) { Scanner sc = new Scanner(System.in); Pattern p = Pattern.compile("[^w]+w*"); Matcher m = p.matcher(sc.nextLine()); int max = 0; ArrayList<String> ans = new ArrayList<>(); while(m.find()) { String s = m.group(); int count = 0; for(int i=0;i<s.length();i++) { if (s.charAt(i) == kusa) { count++; } } if (max <= count) { if (max < count) { ans.clear(); } ans.add(s.substring(0,s.length()-count)); max = count; } } if (max == 0 || ans.size() == 0) { System.out.println(); }else{ for(String s:ans) { System.out.println(s); } } } }