We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There are 99 numbers in test case #2, not just 5 :) If you go further, at some point energy will be so huge that 2*energy will be too big.
if you can't see it just add debug line to your while, something like that:
while (energy >= 0 && j <= n) {
energy = 2*energy - h[j]; j++;
if (i == 1762) cout << j << ' ' << energy << '\n';
}
Chief Hopper
You are viewing a single comment's thread. Return to all comments →
There are 99 numbers in test case #2, not just 5 :) If you go further, at some point energy will be so huge that 2*energy will be too big. if you can't see it just add debug line to your while, something like that:
and look at the output.