|  | 
|  | 
| back to board | what's wrong with test9? Posted by Berlin  21 Jun 2011 20:53this is my programm (WA 9):#include <iostream>
 #include <cmath>
 #include <iomanip>
 #define PI 3.1415926535897932
 using namespace std;
 
 int answer(int n, int k);
 int main()
 {
 int a,r;
 cin>>a>>r;
 double d=a/2;
 double O=2*acos(d/r);
 double s=2*r*r*(O-sin(O));
 double sk=PI*r*r;
 double sq=a*a;
 if (r<=a/2) cout<<setiosflags(ios::fixed)<<setprecision(3)<<sk<<endl;
 else if (r>=a*(sqrt(2.0)/2)) cout<<setiosflags(ios::fixed)<<setprecision(3)<<sq<<endl;
 else cout<<setiosflags(ios::fixed)<<setprecision(3)<<sk-s<<endl;
 }
Re: what's wrong with test9? Posted by Berlin  5 Jul 2011 12:16Please help!Re: what's wrong with test9? should be "double d = a/2.0;" in line 3 in main function | 
 | 
|