hi everyone, i just started go today and was working through some problems from codeforces and am currently on this problem http://codeforces.com/problemset/problem/96/A and trying to do it with go but it says I cannot have a non constant length of array but I have no idea to work around this. If I could get some help thanks. Here is my code: <script https://gist.github.com/gauravdesale/bb48bf0af6a9a1bb0813632bb56f66bd
评论:
wybiral:
0xjnml:You can define it as a slice and then "make" the array (allocate at runtime). https://play.golang.org/p/G7xuk8hiJu
But it will still fail because your i+j causes an array out-of-bounds access.
EDIT: I also changed some of your assignments. You only use ":=" to declare AND assign. So if you already used "var" to declare then don't use ":=" to assign (just use "="). Or just don't use "var" and declare with ":=".
