結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー yuppe19 😺
提出日時 2015-05-08 23:17:13
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 14,749 ms
コンパイル使用メモリ 238,920 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 11:51:13
合計ジャッジ時間 11,836 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

var DEBUG bool = false
func debugsln(s string) { if DEBUG { fmt.Println(s) } }
func debugln(n int) { if DEBUG { fmt.Println(n) } }
func debug(s string, a ...interface{}) { if DEBUG { fmt.Printf(s, a...) } }

func main() {
  var d int
  fmt.Scanf("%d", &d)
  var s1, s2 string
  fmt.Scanf("%s\n%s", &s1, &s2)
  s := s1 + s2
  ha := 0
  for i:=0; i<len(s); i++ {
    debugln(i)
    cp := []rune(s)
    cpd := d
    for j:=i; j<len(s); j++ {
      if cpd > 0 && cp[j] == 'x' {
        cp[j] = 'o'
        cpd--
      }
    }
    if cpd > 0 { continue }
    cnt := 0
    for j:=0; j<len(s); j++ {
      if cp[j] == 'o' {
        cnt += 1
      } else {
        cnt = 0
      }
      if ha < cnt {
        ha = cnt
      }
    }
  }
  fmt.Printf("%d\n", ha)
}
0