Skip to content

Instantly share code, notes, and snippets.

@fa7ad
Last active April 8, 2016 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fa7ad/6587e36460027b22c210 to your computer and use it in GitHub Desktop.
Save fa7ad/6587e36460027b22c210 to your computer and use it in GitHub Desktop.
Check if a point is in the circle. Problem: https://algo.codemarshal.org/problems/55184554742a2fff09a42faa
#include <bits/stdc++.h>
using namespace std;
int main()
{
int cn;
ostringstream oss;
cin >> cn;
for (int i = 0; i < cn; i++) {
int centerX, centerY, radius, pointX, pointY, distance;
cin >> centerX >> centerY >> radius >> pointX >> pointY;
distance = sqrt(pow((centerX - pointX), 2) + pow((centerY - pointY), 2));
string yn = (distance >= radius) ? "no" : "yes";
oss << "Case " << i + 1 << ": " << yn << endl;
}
cout << oss.str();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment