#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
#define PI 3.14159265
double integrate(double x1, double x2, double r)
{
double r1 = (std::sqrt(r*r - x1*x1)/2 * x1 + (9*asin(x1/3))/2);
double r2 = (std::sqrt(r*r - x2*x2)/2 * x2 + (9*asin(x2/3))/2);
return 4 * (r2 - r1);
}
void calculate(double radius)
{
double Result = integrate(0, radius, radius);//((9.0/4.0) + (sqrt(6) / 2.747319)) * radius * radius;
double realResult = PI * radius * radius;
printf("The area of the circle with radius %lf is %lf.\n",radius,Result);
printf("The real area of the circle is %lf.",realResult);
cout << endl;
}
int main(int nNumberofArgs,char* pszArgs[])
{
double radius;
cout << "Enter radius: ";
cin >> radius;
calculate(radius);
//system("PAUSE");
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGNtYXRoPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgUEkgMy4xNDE1OTI2NQoKZG91YmxlIGludGVncmF0ZShkb3VibGUgeDEsIGRvdWJsZSB4MiwgZG91YmxlIHIpCnsKICAgIGRvdWJsZSByMSA9IChzdGQ6OnNxcnQocipyIC0geDEqeDEpLzIgKiB4MSArICg5KmFzaW4oeDEvMykpLzIpOwogICAgZG91YmxlIHIyID0gKHN0ZDo6c3FydChyKnIgLSB4Mip4MikvMiAqIHgyICsgKDkqYXNpbih4Mi8zKSkvMik7CiAgICAKICAgIHJldHVybiA0ICogKHIyIC0gcjEpOwp9Cgp2b2lkIGNhbGN1bGF0ZShkb3VibGUgcmFkaXVzKQp7CiAgICBkb3VibGUgUmVzdWx0ID0gaW50ZWdyYXRlKDAsIHJhZGl1cywgcmFkaXVzKTsvLygoOS4wLzQuMCkgKyAoc3FydCg2KSAvIDIuNzQ3MzE5KSkgKiByYWRpdXMgKiByYWRpdXM7CiAgICBkb3VibGUgcmVhbFJlc3Vs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