fork download
  1. #define _CRT_SECURE_NO_DEPRECATE
  2. #include <iostream>
  3. #include <cmath>
  4. #include <cstdio>
  5. #include <vector>
  6. #include <algorithm>
  7. #include <map>
  8. #include <set>
  9. #include <cstring>
  10. #include <ctime>
  11. #include <string>
  12. using namespace std;
  13. #define inf 1000000000
  14. #define ll long long
  15. #define eps 1e-9
  16. #define VI vector<int>
  17. #define pb push_back
  18. #define L(s) (int)((s).size())
  19. #define all(s) (s).begin(), (s).end()
  20. #define pii pair<int, int>
  21. #define mp make_pair
  22. #define x first
  23. #define y second
  24. #define ull unsigned ll
  25. int main() {
  26. int T1 = 0, T2 = 0;
  27. double s1 = 0, s2 = 0;
  28.  
  29. for(double phi = 0; phi < 2 * 2 * acos(0.); phi += 0.01)
  30. for(double r = 0; r < 1; r += 0.01) {
  31. ++T1; s1 += r * r; // * cos^2(phi) + sin^2(phi)
  32. }
  33.  
  34. for(double x = -1; x < 1; x += 0.01)
  35. for(double y = -sqrt(1. - x * x); y < sqrt(1. - x * x); y += 0.01) {
  36. ++T2; s2 += x * x + y * y;
  37. }
  38.  
  39. cout << s1 / T1 << " " << s2 / T2 << endl;
  40. }
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
0.32835 0.501312