Loading...
Submission
# When Author Problem Language CPU Memory
20822 2024-06-09 08:48:20 AHAMMED_99 Spinning Spinners C 1 ms 2172 kb Wrong Answer - 2
Test Cases
# CPU Memory Points
1 0 ms 2168 kb 1 Accepted
2 1 ms 2172 kb 0 Wrong Answer
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 distance to the farthest point of the rectangle
  17. double rectangle_farthest = d + sqrt(pow(h / 2.0, 2) + pow(w / 2.0, 2));
  18.  
  19. // Calculate distance to the farthest point of the equilateral triangle
  20. double triangle_farthest = (x - d) + (a / sqrt(3));
  21.  
  22. // Determine the maximum radius
  23. double max_radius = fmax(rectangle_farthest, triangle_farthest);
  24.  
  25. // Calculate the area
  26. double area = PI * pow(max_radius, 2);
  27.  
  28. // Print the result
  29. printf("Case %d: %.4f\n", case_no, area);
  30. }
  31.  
  32. return 0;
  33. }
  34.