prestige

Untitled

Mar 30th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #include <algorithm>
  2. #include <bitset>
  3. #include <cassert>
  4. #include <cmath>
  5. #include <cstdio>
  6. #include <cstdlib>
  7. #include <cstring>
  8. #include <iostream>
  9. #include <list>
  10. #include <map>
  11. #include <queue>
  12. #include <set>
  13. #include <string>
  14. #include <sstream>
  15. #include <vector>
  16. #include <complex>
  17. #include <ctime>
  18. #include <stack>
  19.  
  20. using namespace std;
  21.  
  22. typedef long long ll;
  23. typedef unsigned long long ull;
  24. typedef vector<int> VI;
  25. typedef vector< VI > VVI;
  26. typedef pair<int, int> PII;
  27. typedef vector<PII> VPII;
  28.  
  29. #define REP(i, n) for(int i = 0; i < (n); ++i)
  30. #define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
  31. #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
  32. #define RFOR(i, x, y) for(int i = (x); i >= (y); --i)
  33. #define SZ(a) (ll)(a).size()
  34. #define ALL(a) (a).begin(),(a).end()
  35. #define SORT(a) sort(ALL(a))
  36. #define CLEAR(x) memset(x, 0, sizeof x);
  37. #define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
  38. #define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
  39. #define pb push_back
  40. #define mk make_pair
  41. #define sqr(x) ((x)*(x))
  42. #define X first
  43. #define Y second
  44. const long double pi=acos(-1.0);
  45. const double EPS = 1E-9;
  46. const int INF = 2 * (1e+9) + 1;
  47. const int NMAX = 1000000;
  48. const int MOD = (1e+9) + 7;
  49.  
  50. int a, b, c;
  51. int main () {
  52. cin >> a >> b;
  53. c = sqr(a) + sqr(b);
  54. FOR (i, 1, 1000) {
  55. FOR (j, 1, 1000) {
  56. j *= -1;
  57. int ay = 0, by = 0;
  58. ay = sqrt (sqr(a) - sqr(i) + .0);
  59. by = sqrt (sqr(b) - sqr(j) + .0);
  60. if (sqr(ay) == sqr(a) - sqr(i) && sqr(by) == sqr(b) - sqr(j)) {
  61. int tmpc = sqr(i - j) + sqr(ay - by);
  62. if (tmpc == c) {
  63. cout << "YES\n";
  64. cout << "0 0\n";
  65. cout << i << " " << ay << endl << j << " " << by;
  66. return 0;
  67. }
  68. }
  69. j *= -1;
  70. }
  71. }
  72. cout << "NO\n";
  73. }
  74. /*
  75. 3
  76. 1 1 1
  77. 0 1 1
  78. 1 0 0
  79. 12
  80. 3
  81. 2 3
  82. 3
  83. 2 2
  84. 2 2
  85. 1 3
  86. 3
  87. 3
  88. 1 2
  89. 2 1
  90. 1 1
  91. 3
  92. */
Advertisement
Add Comment
Please, Sign In to add comment