|
|
вернуться в форумanyone can tell me what's wrong? Послано mon 3 фев 2002 02:36 thanks... #include <stdio.h> #include <math.h> #define PI 3.1416 int main() { double a, r, area; scanf("%lf%lf", &a, &r); a /= 2; if (a >= r) { printf("%.3f\n", PI * r * r); return 0; } if (r >= sqrt(2) * a) { printf("%.3f\n", 4 * a * a); return 0; } printf("%.3f\n", PI * r * r - 4 * (acos(a / r) * r * r - a * sqrt(r * r - a * a))); return 0; } I don't know whether <math.h> is allowed,but you can... > thanks... > > #include <stdio.h> > #include <math.h> ?????? You can use integral to calculate the area Instead of using any mathematic function. I got the answer Послано mon 3 апр 2002 12:33 I should use ".3lf" instead of ".3f" in the format string of printf. but was that AC??? > I should use ".3lf" instead of ".3f" in the format string > of printf. Re: anyone can tell me what's wrong? Послано 8P 14 фев 2010 22:53 #define PI 3.1416 // no #define PI 3.1415926535897932 //yes Re: anyone can tell me what's wrong? Послано oybek 17 май 2014 17:54 Better to use standard M_PI Edited by author 17.05.2014 17:54 |
|
|