結果
| 問題 | No.204 ゴールデン・ウィーク(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-28 11:48:14 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 561 bytes |
| 記録 | |
| コンパイル時間 | 67 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-05-01 00:35:57 |
| 合計ジャッジ時間 | 3,040 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | WA * 1 TLE * 1 -- * 44 |
コンパイルメッセージ
Syntax OK
ソースコード
def holiday s
s += 'x'
tmp = ans = 0
15.times{|i|
if s[i] == 'o'
tmp += 1
else
ans = [tmp, ans].max
tmp = 0
end
}
return ans
end
def sol d, s
if d == 0
return holiday(s)
else
ans = 0
14.times{|i|
if s[i] == 'x'
s[i] = 'o'
ans = [sol(d - 1, s), ans].max
s[i] = 'x'
end
}
return ans
end
end
d = gets.to_i
s = STDIN.map(&:chomp).join('')
p sol(d, s)