結果
問題 | No.203 ゴールデン・ウィーク(1) |
ユーザー | r.suzuki |
提出日時 | 2015-12-25 01:00:49 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 132 ms / 1,000 ms |
コード長 | 938 bytes |
コンパイル時間 | 3,625 ms |
コンパイル使用メモリ | 80,212 KB |
実行使用メモリ | 41,724 KB |
最終ジャッジ日時 | 2024-04-29 08:01:40 |
合計ジャッジ時間 | 8,409 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
40,740 KB |
testcase_01 | AC | 124 ms
41,224 KB |
testcase_02 | AC | 129 ms
41,408 KB |
testcase_03 | AC | 126 ms
40,932 KB |
testcase_04 | AC | 113 ms
39,936 KB |
testcase_05 | AC | 130 ms
41,344 KB |
testcase_06 | AC | 131 ms
40,924 KB |
testcase_07 | AC | 127 ms
41,028 KB |
testcase_08 | AC | 125 ms
40,952 KB |
testcase_09 | AC | 128 ms
41,532 KB |
testcase_10 | AC | 128 ms
40,964 KB |
testcase_11 | AC | 130 ms
41,328 KB |
testcase_12 | AC | 130 ms
41,188 KB |
testcase_13 | AC | 128 ms
41,228 KB |
testcase_14 | AC | 130 ms
41,012 KB |
testcase_15 | AC | 113 ms
40,032 KB |
testcase_16 | AC | 130 ms
41,056 KB |
testcase_17 | AC | 129 ms
40,876 KB |
testcase_18 | AC | 126 ms
40,960 KB |
testcase_19 | AC | 127 ms
41,196 KB |
testcase_20 | AC | 126 ms
41,344 KB |
testcase_21 | AC | 116 ms
40,304 KB |
testcase_22 | AC | 127 ms
41,724 KB |
testcase_23 | AC | 131 ms
41,536 KB |
testcase_24 | AC | 128 ms
41,088 KB |
testcase_25 | AC | 132 ms
41,568 KB |
testcase_26 | AC | 119 ms
40,252 KB |
testcase_27 | AC | 131 ms
41,320 KB |
testcase_28 | AC | 132 ms
41,224 KB |
ソースコード
public class No_203 { //休日の数を数える static int holiday(StringBuffer w, int c) { c++; if (c >= w.length() || !(w.charAt(c) == 'o')) { return c; } return holiday(w, c); } //平日の数を数える static int weekday(StringBuffer w, int c) { c++; if (c >= w.length() || !(w.charAt(c) == 'x')) { return c; } return weekday(w, c); } public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); String s = sc.next() + sc.next(); StringBuffer week = new StringBuffer(s); int count = 0, max = 0; while (!week.toString().isEmpty()) {//文字列が無くなったら終わり if (week.charAt(0) == 'o') { count = holiday(week, 0); week.delete(0, count);//count分削除 max = Math.max(max, count); } else { count = weekday(week, 0); week.delete(0, count);//count分削除 } } System.out.println(max); sc.close(); } }