結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー rocoder
提出日時 2017-07-15 20:59:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-08 02:40:38
合計ジャッジ時間 3,038 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#golden week
D=int(input())
C1=input()
C2=input()
C=C1+C2
i=0
Cn=[]
while i<len(C):
    co=0
    while i <len(C) and C[i]=="o":
        co+=1
        i+=1
    Cn.append (co)
    co=0
    while i <len(C) and C[i]=="x":
        co+=1
        i+=1
    Cn.append (co)
m=0
j=0
#print (Cn)
while j<len(Cn):
    V=D
    i=j
  #  print (i)
    g=0
    while i<len(Cn) and V>=0:
        if i%2==0:
            g+=Cn[i]
     #       print (g)
        elif V>=Cn[i]:
            g+=Cn[i]
            V-=Cn[i]
        elif V>0:
            g+=V
            V=0
        else:
            V=-1
        i+=1
    #    print (D)
 #   print (g)
    if g>m:
        m=g
    j+=1
print(m)
0