7月4日 Is This Integration

Is This Integration

#include <iostream>
#include <cmath>
#define pi 3.141592653589793
using namespace std;

int main(){
  double a;
  while(cin >> a){
    double x, y, z;
    double triangle = a * a * sin(pi / 3.0) / 2;
    double sector = pi * a * a * (1 / 6.0);
    double sector4 = pi * a * a * 0.25;

    x = a * a  - triangle - sector;

    z = (4 * sector4 - 3 * a * a + x * 4);

    y = (a * a - 4 * x - z) / 4.0;

    printf("%.3f %.3f %.3f\n", z, y * 4, x * 4);
  }
  return 0;
}
posted @ 2023-08-23 23:24  tlocd  阅读(8)  评论(0编辑  收藏  举报