Magic Square

A little boy Towhid is good at mathematics. He solves a lot of mathematical equation regularly. He i…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

#include<stdio.h>
int main()
{
long long int i,T,n,a;
float b;
scanf(“%lld”,&T);
for(i=1; i<=T; i++){
scanf(“%lld”,&n);
b= ((((n*n)+1)1.00)/2);
a=b
n;
printf(“Case %lld: %lld\n”,i,a);
}

}
What’s the problem with the code??? Showing Wrong Answer in the sample test case???Plz , help.,…

I think, The judge is going crazy here .In IDE the result comes 500000500,but in the judge, it becomes 500000512!!!
What is going on???

Simplify your equation and don’t use float.
It’s solvable without using any floating point number.
Maybe your IDE is smarter and handle many errors you code. :slight_smile: