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 30 31 32 33 34 35 36 37 38 |
#include <iostream> #include <cmath> #include <cstdio> #define PI acos(-1) using namespace std; //using the formulae a/sin A = b/sin B = c/sin C int main() { double L,W,H,angle; double changed_hight,res,changed_base,empty_area; while(scanf("%lf%lf%lf%lf",&L,&W,&H,&angle)!=EOF) { changed_hight= sin(angle*PI/180)*L/sin((90-angle)*PI/180); if(angle==0) { printf("%.3lf mL\n",L*W*H); } else if(angle==90) { printf("%.3lf mL\n",0); } else if(changed_hight<=H) { empty_area=changed_hight*L*W/2; res = L*W*H-empty_area; printf("%.3lf mL\n",res); } else { changed_base = H * sin((90-angle)*PI/180)/sin(angle*PI/180); res = H*changed_base*W/2; printf("%.3lf mL\n",res); } } return 0; } |