Loading...
Submission
# When Author Problem Language CPU Memory
20823 2024-06-09 08:49:17 AHAMMED_99 Spinning Spinners C 0 ms 1928 kb Wrong Answer - 1
Test Cases
# CPU Memory Points
1 0 ms 1928 kb 0 Wrong Answer
2 0 ms 0 kb 0 Skipped
3 0 ms 0 kb 0 Skipped
4 0 ms 0 kb 0 Skipped
5 0 ms 0 kb 0 Skipped
6 0 ms 0 kb 0 Skipped
Source Code
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #define PI 3.1416
  5.  
  6. int main() {
  7. int T;
  8. scanf("%d", &T);
  9.  
  10. for (int case_no = 1; case_no <= T; case_no++) {
  11. int x, d, h, w, a;
  12. scanf("%d %d", &x, &d);
  13. scanf("%d %d", &h, &w);
  14. scanf("%d", &a);
  15.  
  16. // Calculate the distance to the farthest point of the rectangle
  17. double half_h = h / 2.0;
  18. double half_w = w / 2.0;
  19. double rectangle_farthest = d + sqrt(half_h * half_h + half_w * half_w);
  20.  
  21. // Calculate the distance to the farthest point of the equilateral triangle
  22. double triangle_height = a * sqrt(3.0) / 2.0; // height of the equilateral triangle
  23. double triangle_farthest = (x - d) + triangle_height / 3.0; // centroid is at 1/3 of the height
  24.  
  25. // Determine the maximum radius
  26. double max_radius = fmax(rectangle_farthest, triangle_farthest);
  27.  
  28. // Calculate the area
  29. double area = PI * max_radius * max_radius;
  30.  
  31. // Print the result
  32. printf("Case %d: %.4f\n", case_no, area);
  33. }
  34.  
  35. return 0;
  36. }
  37.