fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. double distance(double ax, double ay, double bx, double by)
  4. {
  5. double a, b, d;
  6. a = (ax-bx)*(ax-bx);
  7. b = (ay-by)*(ay-by);
  8. d = sqrt(a+b);
  9. return d;
  10. }
  11. int main()
  12. {
  13. int t;
  14. cin >> t;
  15. for(int i = 1; i<=t; i++)
  16. {
  17. double ox, oy, ax, ay, bx, by, r, a, s, value, thita;
  18. cin >> ox >> oy >> ax >> ay >> bx >> by;
  19. r = distance(ox,oy, ax, ay);
  20. // cout << r << endl;
  21. a = distance(ax,ay, bx, by);
  22. // cout << a << endl;
  23. value = (2*r*r-a*a)/(2*r*r);
  24. thita = acos(value);
  25. // cout << thita << endl;
  26. s = r*thita;
  27. //cout << s << endl;
  28. printf("Case %d: %.9lf\n",i,s);
  29. }
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 4528KB
stdin
5

5711 3044 477 2186 3257 7746

3233 31 3336 1489 1775 134

453 4480 1137 6678 2395 5716

8757 2995 4807 8660 2294 5429

4439 4272 1366 8741 6820 9145
stdout
Case 1: 6641.816991834
Case 2: 2295.928807867
Case 3: 1616.690325001
Case 4: 4155.641593404
Case 5: 5732.012502526