結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2017-01-13 10:36:01 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 747 bytes |
コンパイル時間 | 327 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-12-21 11:53:30 |
合計ジャッジ時間 | 7,127 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 WA * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
d = gets.strip.to_i #p d week1 = gets.strip week2 = gets.strip #p week1 #p week2 weeks = "x" * d + week1 + week2 + "x" * d #p weeks def count_max_o(weeks) count_max = 0 count = 0 (0...weeks.length).each do |i| if weeks[i] == 'o' count += 1 else if count > count_max count_max = count end count = 0 end end if count > count_max count_max = count end #p count_max return count_max end count_max = 0 count = 0 i = 0 while i < weeks.length do if weeks[i] == 'o' i += 1 next end weeks1 = weeks.clone (0...d).each do |j| if weeks[i + j] == 'o' break else weeks1[i + j] = 'o' end end #p weeks1 count = count_max_o(weeks1) if count > count_max count_max = count end i += 1 end p count_max