To get accepted I had to use PI = acos(-1).
Lets assume X = middle portion; Y = dotted region; Z = stripped region;
Three independent equations are:
X+ 4*Y + 4*Z = a*a……………………………………………….(1)
Y + 2*Z = a*a – PI*a*a/4………………………………………..(2)
X/2 + Y + Z/2 = (PI*a*a)/4 – ΔPAR………………………..(3)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <iostream> #include <cstdio> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <cstdlib> #define PI acos(-1) #define ll long long #define THIRD (12-2*PI-3*sqrt(3))/12 //0.0433886732 #define SECOND (PI+6*sqrt(3)-12)/12 //0.12782449020255 using namespace std; int main() { double a,b,c,d; //cout<<THIRD<<"\n"; while(scanf("%lf",&a)!=EOF) { b = 4*SECOND*a*a; c = 4*THIRD*a*a; d = a*a - b - c; printf("%.3lf %.3lf %.3lf\n",d,b,c); } return 0; } |