結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2017-01-13 10:18:22 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 42 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-12-21 11:53:17 |
| 合計ジャッジ時間 | 5,210 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 WA * 14 |
コンパイルメッセージ
Syntax OK
ソースコード
d = gets.strip.to_i #p d week1 = gets.strip week2 = gets.strip #p week1 #p week2 weeks = week1 + week2 #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 weeks1 = weeks.clone if weeks[i] == 'o' i += 1 next end (1..d).each do |j| if weeks[i] == 'o' break else weeks1[i] = 'o' end i += 1 end #p weeks1 count = count_max_o(weeks1) if count > count_max count_max = count end i += 1 end p count_max
suppy193