Hi4ko's blog

By Hi4ko, 12 years ago, translation, In English

Problem #1036 I've already got some help, Thanks :)

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +3 Vote: I do not like it

You are not initialising ar[i][j]=0. Since you are declaring the array inside your main function, the initial values might be garbage. So start with declaring long long ar[51][1001]; as a global array or set ar[i][j]=0 inside your loop

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It doesn't work

    • »
      »
      »
      12 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      See SamanSami's comment.I looked at the forum for the problem, The answer can be so big that it won't fit in long long.

»
12 years ago, # |
  Vote: I like it +6 Vote: I do not like it

The answer might not fit in long long.

  • »
    »
    12 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Hi, SamanSami is right, I tried here with ull and got WA on test case #8, then I changed to bignum and got accepted.

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Use BigInteger....