关于G题数据的疑问

按照给定的边数 m 进行读入,为什么通过了 65% 的数据后发生 `ValueError: not enough values to unpack (expected 3, got 0)` 的情况,是因为python的读写限制吗?
读入部分的代码如下
n, m = map(int, input().split())
stt, end = map(int, input().split())
for _ in range(m):
    u, v, w = map(int, input().split())

希望有大佬可以指导一下。
全部评论
expected 3, got 0,估计是有数据里有空行,用了input读取读不到数据 你可以自己测试一下,写一个python代码:a, b, c = map(int, input().split()),然后不输入直接回车,就会出现expected 3, got 0的错误
点赞 回复 分享
发布于 2021-12-19 21:47

相关推荐

09-25 00:00
已编辑
电子科技大学 Java
球球与墩墩:这不是前端常考的对象扁平化吗,面试官像是前端出来的 const flattern = (obj) => { const res = {}; const dfs = (curr, path) => { if(typeof curr === 'object' && curr !== null) { const isArray = Array.isArray(curr); for(let key in curr) { const newPath = path ? isArray ? `${path}[${key}]` : `${path}.${key}` : key; dfs(curr[key], newPath); } } else { res[path] = curr } } dfs(obj); return res; }
查看3道真题和解析
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务