- Julia
【求救】Julia原生的矩阵乘法在此题WA
- 2021-7-31 1:43:19 @
如题 是个求救帖 这个题目即 矩阵乘法H1005
评测记录在 这里
下面是代码
function str2int(s)::Int128
ans::Int64 = 0
for i in 1:length(s)
ans = (ans << 3) + (ans << 1) + Int(s[i]) - 48
end
return ans
end
global myInput = map(str2int, split(readline(stdin)))
n = myInput[1]; m = myInput[2]; p = myInput[3]
L1 = zeros(Int128, n, m)
L2 = zeros(Int128, m, p)
for i in 1:n
global myInput = map(str2int, split(readline(stdin)))
for j in 1:m
L1[i, j] = myInput[j]
end
end
for i in 1:m
global myInput = map(str2int, split(readline(stdin)))
for j in 1:p
L2[i, j] = myInput[j]
end
end
ans = L1 * L2
ans = map(function (x::Int128) x = mod(x, 1000000007);x += 1000000007; x = mod(x, 1000000007) end, ans)
for i in 1:n
for j in 1:p
print(ans[i, j], ' ')
end
println()
end
3 条评论
-
Jelly_Aries @ 2021-8-3 10:31:43
哈?展开写是指?
-
2021-7-31 14:03:31@
-
2021-7-31 1:44:10@
由于第一个测试点通过所以我觉得这件事情很奇怪 也许是因为做乘法的时候爆了
- 1