Calculus Very Weak Test Cases ☹️

#include <iostream>
using namespace std;

int main() {
	int n;
	return 0;

WTH , how this solution is AC @admin


lol :joy: :joy:

LOL :joy:

Why shouldn’t be it AC. Almost everyone has same solution. It was just that there was only four test cases. And the last two were very easy to find out.
Just put assert and find out the value of N

1 Like

One can binary search the testcases


binary search on testcases

Very Disappointing!

How please mention??

I used matlab to get some answers and then used them to predict the expression simply came out as 2*(1/1 + 1/3 + 1/5 …) . Took much time to figure out. But indeed the above scenario happened due to much less test cases.


Actually this is quite ingenius

I manipulated it into this expression Wolfram and then changed values of n to guess it.Frankly I dont see how a person without the knowledge of Parseval’s Theorm could have solved it

Check Errichto’s video-

It is basically a hit and trial type. Suppose we know in Calculus problem, N<=10^6.
Put a assert- assert(N>=999990 and N<=1000000);
and print anything. Any number outside this range, should give a Runtime Error. Like this, increase the bound.
assert(N>=999995 and N<=1000000);
Like this, going on, we find that N=999999 and N=1000000


I think we can solve it by Cauchy’s Residue Theorem as well. Wan’t able to prove that the integral of the semi-circle arcs is zero. Figured out it must be zero based on the example values given. The residue of the poles is equal to our integral.

What would you say for a guy from my college who did not use any assert in his code but still got
AC by cracking those cases . I mean did he got dreams of those test cases :frowning:

There is a thing called as “friends/telegram/youtube” :wink:


Do you mean you solved the problem completely or you just guessed those testcases?

If it’s guessing, you should have tried your luck at some lottery. :slight_smile:

1 Like

no not me , I used online calculator of Wolfram alpha

There should be System Testing in Codechef also.