全部评论
今天的
if count == m*n { fmt.Println("Yes") fmt.Println(k) return } fmt.Println("No") fmt.Println(m*n-count) }
我也是, 第二题 func main() { var n, m, k int var s string fmt.Scanf("%d %d %d", &n,&m,&k) fmt.Scanf("%s", &s) data := make([][]int, n) for i,_ := range data { data[i] = make([]int, m) } data[0][0] = 1 count := 1 tempi := 0 tempj := 0 for i:=0; i<k; i++ { fmt.Println(tempi, tempj, data[tempi][tempj], s[i], count) if count == m*n { fmt.Println("Yes") fmt.Println(i) return } if s[i] == 'W&(30501)#39; { if tempi > 0 { tempi-- if data[tempi][tempj] == 0 { data[tempi][tempj] = 1 count++ } } } else if s[i] == 'D' { if tempj < m-1 { tempj++ if data[tempi][tempj] == 0 { data[tempi][tempj] = 1 count++ } } } else if s[i] == 'S&(30503)#39; { if tempi < n-1 { tempi++ if data[tempi][tempj] == 0 { data[tempi][tempj] = 1 count++ } } } else { if tempj > 0 { tempj-- if data[tempi][tempj] == 0 { data[tempi][tempj] = 1 count++ } } } }
我用的js 第一题也是过不了... 以为自己错了 看了下别人解法和我一模一样 至今不知道为什么
我也用的go,能过的
用的scan输入还是newreader
相关推荐
点赞 评论 收藏
分享