There is a cow in a village. She eats as much grass as she wants. Fortunately there is a large field…
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<bits/stdc++.h>
using namespace std;
#define ll long long int
#define max_3(a,b,c) max(a, max(b,c))
#define pi 2*acos(0.0)
int main()
{
float t,n,c=3.1415991188,d;
cin>>t;
while(t--){
cin>>n;
d=c*pow(n,2);
printf("%.3f\n",d);
}
}
the problem was with the value of pi. pi is a rational number. google shows 3.14159265359 as the value of pi. but gives wrong answer. So I performed a simple trick. to check the value of pi, perform 1049558.294/(578*578) and you will get pi equal 3.1415999988. Done.