結果
問題 | No.203 ゴールデン・ウィーク(1) |
ユーザー |
![]() |
提出日時 | 2015-12-25 01:00:49 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 125 ms / 1,000 ms |
コード長 | 938 bytes |
コンパイル時間 | 3,302 ms |
コンパイル使用メモリ | 81,796 KB |
実行使用メモリ | 54,212 KB |
最終ジャッジ日時 | 2024-11-18 09:38:40 |
合計ジャッジ時間 | 7,643 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
53,764 KB |
testcase_01 | AC | 106 ms
52,944 KB |
testcase_02 | AC | 119 ms
54,020 KB |
testcase_03 | AC | 117 ms
54,120 KB |
testcase_04 | AC | 118 ms
54,136 KB |
testcase_05 | AC | 120 ms
54,056 KB |
testcase_06 | AC | 121 ms
54,148 KB |
testcase_07 | AC | 118 ms
54,092 KB |
testcase_08 | AC | 118 ms
53,924 KB |
testcase_09 | AC | 120 ms
53,872 KB |
testcase_10 | AC | 119 ms
54,020 KB |
testcase_11 | AC | 119 ms
54,132 KB |
testcase_12 | AC | 120 ms
53,968 KB |
testcase_13 | AC | 124 ms
54,160 KB |
testcase_14 | AC | 119 ms
54,212 KB |
testcase_15 | AC | 122 ms
53,888 KB |
testcase_16 | AC | 120 ms
53,800 KB |
testcase_17 | AC | 107 ms
52,700 KB |
testcase_18 | AC | 125 ms
54,160 KB |
testcase_19 | AC | 109 ms
54,164 KB |
testcase_20 | AC | 120 ms
54,088 KB |
testcase_21 | AC | 120 ms
54,028 KB |
testcase_22 | AC | 107 ms
53,108 KB |
testcase_23 | AC | 122 ms
54,096 KB |
testcase_24 | AC | 110 ms
53,068 KB |
testcase_25 | AC | 119 ms
53,920 KB |
testcase_26 | AC | 106 ms
52,780 KB |
testcase_27 | AC | 119 ms
53,952 KB |
testcase_28 | AC | 124 ms
54,008 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(); } }