結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー nari11111
提出日時 2015-05-08 23:29:34
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 462 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-10-13 11:53:56
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 15 RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
w = raw_input()+raw_input()

sall=[]
ball=[]
s = 0
b = 0

for e in w:
    if e=='o':
        if b>0:
            ball.append(b)
        b=0
        s+=1
    else:
        if s>0:
            sall.append(s)
        s=0
        b+=1

sall.append(s)
ball.append(b)

all=[]

for i in xrange(len(sall)-1):
    all.append(sall[i]+sall[i+1])

anss=[]

for i,e in enumerate(ball):
    if e<=n and e!=0:
        anss.append(e+all[i])

print max(anss)
0