結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー fine
提出日時 2016-03-29 00:24:41
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-10-13 13:58:14
合計ジャッジ時間 5,404 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def holiday s
    s += 'x'
    tmp = ans = 0
    43.times{|i|
        if s[i] == 'o'
            tmp += 1
        else
            ans = [tmp, ans].max
            tmp = 0
        end
        }
    return ans
end

def sol d, s
    ans = 0
    (43 - d).times{|i|
        ans = [ans, holiday(s[0...i].to_s + 'o' * d + s[(i + d)..-1].to_s)].max
        }
    return ans
end

d = gets.to_i
s = STDIN.map(&:chomp).join('')
s = 'x' * 14 + s + 'x' * 14
p sol(d, s)
0