Last active
April 8, 2016 10:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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