結果
問題 | No.345 最小チワワ問題 |
ユーザー | yuikibis |
提出日時 | 2016-02-28 21:40:57 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 874 bytes |
コンパイル時間 | 2,093 ms |
コンパイル使用メモリ | 74,264 KB |
実行使用メモリ | 57,728 KB |
最終ジャッジ日時 | 2023-10-24 18:48:50 |
合計ジャッジ時間 | 7,207 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
57,728 KB |
testcase_01 | AC | 121 ms
55,220 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 117 ms
57,300 KB |
testcase_05 | WA | - |
testcase_06 | AC | 122 ms
57,424 KB |
testcase_07 | AC | 120 ms
55,328 KB |
testcase_08 | AC | 120 ms
57,456 KB |
testcase_09 | AC | 110 ms
56,200 KB |
testcase_10 | AC | 122 ms
57,552 KB |
testcase_11 | AC | 106 ms
56,244 KB |
testcase_12 | AC | 120 ms
57,452 KB |
testcase_13 | AC | 120 ms
57,528 KB |
testcase_14 | AC | 119 ms
57,560 KB |
testcase_15 | AC | 117 ms
57,484 KB |
testcase_16 | AC | 118 ms
57,280 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 118 ms
57,476 KB |
testcase_21 | AC | 119 ms
57,472 KB |
testcase_22 | AC | 108 ms
56,816 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 119 ms
57,528 KB |
testcase_29 | WA | - |
testcase_30 | AC | 120 ms
57,572 KB |
testcase_31 | AC | 119 ms
57,556 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String text = scanner.next(); int length = - 1; boolean c = false; boolean w1 = false; int start = 0; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == 'c') { start = i; c = true; } else if (text.charAt(i) == 'w' && c) { if (!w1) { w1 = true; } else { int tmpLength = i - start + 1; if (length < tmpLength) { length = tmpLength; } start = 0; c = w1 = false; } } } System.out.println(length); } }