I was solving the sum MULTHREE

My Code :

I have used long long as well, so why is it showing runtime error? I think my logic is correct, as I tested it with small test-cases and it gave the correct answer.

K can go upto 10^{12}. pow function will return inf when it overflow.

So what should I do to get AC? @ssjgz @vijju123

Crashes on the sample testcase for me.

long long A[k];

K can be as large as 10^{12} - how much stack space do you think the Codechef Online Judge has?

1 Like

Yes, so what is the solution to avoiding this? @ssjgz


Cool, so i came up with a code. But it doesn’t work, please can someone help me.
My code :

Someone please help me, I’m very anxious to finish the problem.