結果
問題 | No.342 一番ワロタww |
ユーザー | Grenache |
提出日時 | 2016-02-12 22:43:56 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,241 bytes |
コンパイル時間 | 3,153 ms |
コンパイル使用メモリ | 78,652 KB |
実行使用メモリ | 57,568 KB |
最終ジャッジ日時 | 2023-10-22 03:17:55 |
合計ジャッジ時間 | 5,788 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
57,528 KB |
testcase_01 | AC | 115 ms
57,520 KB |
testcase_02 | AC | 114 ms
57,496 KB |
testcase_03 | AC | 115 ms
55,544 KB |
testcase_04 | AC | 112 ms
57,456 KB |
testcase_05 | AC | 116 ms
57,492 KB |
testcase_06 | AC | 114 ms
57,496 KB |
testcase_07 | WA | - |
testcase_08 | AC | 105 ms
57,064 KB |
testcase_09 | AC | 102 ms
56,012 KB |
testcase_10 | AC | 110 ms
57,260 KB |
testcase_11 | AC | 110 ms
57,272 KB |
testcase_12 | AC | 113 ms
55,448 KB |
testcase_13 | AC | 96 ms
54,160 KB |
testcase_14 | AC | 105 ms
57,568 KB |
testcase_15 | AC | 108 ms
57,236 KB |
testcase_16 | WA | - |
ソースコード
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main_yukicoder342 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); List<String> str = new ArrayList<String>(); List<Integer> len = new ArrayList<Integer>(); int max = 0; int i = 0; while (i < n) { int j = s.indexOf('w', i); if (j == -1){ str.add(s.substring(i, n)); len.add(0); break; } else { str.add(s.substring(i, j)); i = j; } int tmp = 0; while (i < n && s.charAt(i) == 'w') { tmp++; i++; } len.add(tmp); max = Math.max(max, tmp); } if (str.size() == 1 && len.get(0) == 0) { System.out.println(); } else if (str.size() == 1 && len.get(0) == n) { System.out.println(); } else { for (int j = 0; j < str.size(); j++) { if (len.get(j) == max && str.get(j).length() > 0) { System.out.println(str.get(j)); } } } sc.close(); } }