結果
| 問題 | No.203 ゴールデン・ウィーク(1) |
| コンテスト | |
| ユーザー |
r.suzuki
|
| 提出日時 | 2015-12-25 01:00:49 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 1,000 ms |
| コード長 | 938 bytes |
| 記録 | |
| コンパイル時間 | 3,430 ms |
| コンパイル使用メモリ | 84,112 KB |
| 実行使用メモリ | 46,528 KB |
| 最終ジャッジ日時 | 2026-05-12 21:49:02 |
| 合計ジャッジ時間 | 5,673 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
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();
}
}
r.suzuki