Advertisement
TwITe

Untitled

Jul 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. //goo.gl/zKzUMZ
  2. int min(int a, int b) {
  3.     if (a > b) {
  4.         return b;
  5.     }
  6.     else return a;
  7. }
  8.  
  9. int min4(int a, int b, int c, int d) {
  10.     if ((min(a, b)) > c || (min(a, b)) > d) {
  11.         if (c > d) {
  12.             return d;
  13.         }
  14.         else return c;
  15.     }
  16.     else return (min(a, b));
  17. }
  18.  
  19.  
  20. int main()
  21. {
  22.     int a, b, c, d;
  23.     cin >> a >> b >> c >> d;
  24.     cout << min4(a, b, c, d);
  25.     return 0;
  26. }
  27.  
  28. //goo.gl/nst98y
  29. double distance(double x1, double y1, double x2, double y2) {
  30.     return sqrt((pow((x2 - x1), 2)) + (pow((y2 - y1), 2)));
  31. }
  32.  
  33. int main()
  34. {
  35.     double x1, y1, x2, y2;
  36.     cin >> x1 >> y1 >> x2 >> y2;
  37.     cout << distance(x1, y1, x2, y2);
  38.     return 0;
  39. }
  40.  
  41. //goo.gl/vhZP8V
  42. bool IsPointInSquare(double x, double y) {
  43.     return ((abs(x)<= 1) && (abs(y)<= 1));
  44. }
  45.  
  46. int main()
  47. {
  48.     double x, y;
  49.     cin >> x >> y;
  50.     if (IsPointInSquare(x, y)) {
  51.         cout << "YES";
  52.     }
  53.     else cout << "NO";
  54.     return 0;
  55. }
  56.  
  57. //goo.gl/Db8iHD
  58. bool IsPointInSquare(double x, double y) {
  59.     return ((abs(x)<= 1) && (abs(y)<= 1) && (abs(x) + abs(y)<= 1));
  60. }
  61.  
  62. int main()
  63. {
  64.     double x, y;
  65.     cin >> x >> y;
  66.     if (IsPointInSquare(x, y)) {
  67.         cout << "YES";
  68.     }
  69.     else cout << "NO";
  70.     return 0;
  71. }
  72.  
  73. //goo.gl/y4ar5q
  74. bool IsPointInCircle(double x, double y, double xc, double yc, double r) {
  75.     return (pow(x - xc, 2) + pow(y - yc, 2) <= pow(r, 2));
  76. }
  77.  
  78. int main()
  79. {
  80.     double x, y, xc, yc, r;
  81.     cin >> x >> y >> xc >> yc >> r;
  82.     if (IsPointInCircle(x, y, xc, yc, r)) {
  83.         cout << "YES";
  84.     }
  85.     else cout << "NO";
  86.     return 0;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement