美团今天(8.6号)笔试有用golang提交过不了的吗?

我用go提交,感觉完全正确,但是过不了~#美团笔试##秋招#
全部评论
今天的
点赞 回复 分享
发布于 2022-08-13 19:42
if count == m*n { fmt.Println("Yes") fmt.Println(k) return } fmt.Println("No") fmt.Println(m*n-count) }
点赞 回复 分享
发布于 2022-08-13 19:41
我也是, 第二题 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&#39; { 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++ } } } }
点赞 回复 分享
发布于 2022-08-13 19:41
我用的js 第一题也是过不了... 以为自己错了 看了下别人解法和我一模一样 至今不知道为什么
点赞 回复 分享
发布于 2022-08-07 16:37
我也用的go,能过的
点赞 回复 分享
发布于 2022-08-06 16:22
用的scan输入还是newreader
点赞 回复 分享
发布于 2022-08-06 15:56

相关推荐

点赞 评论 收藏
分享
评论
点赞
2
分享

创作者周榜

更多
牛客网
牛客企业服务