Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
La idea es encontrar el angulo punto que nos dan, usan atan(y/x), comparandolo con nuestros angulos inicial y final
y finalmente que la distancia del punto al centro sea menor o igual al radio
**/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cstdio>
#define PI 3.14159265
using namespace std;
typedef vector<double> vd;
typedef pair<double, double> point;
int t, p, x, y;
point center;
double m, b;
double r = 50.0;
int res , c = 1;
bool isInside (point Ve1){
return pow(Ve1.first - center.first, 2) + pow(Ve1.second - center.second, 2) <= pow (r, 2);
}
int main(){
double a0, a1, a2;
a0 = PI/2.0;
center = make_pair(50.0, 50.0);
scanf("%d", &t);
while(t--){
scanf("%d %d %d", &p, &x, &y);
res = 0;
if(p <= 25 ) a1 = (PI / 2) - ( 2 *PI * ( p / 100.0) );
else if (p <= 50 ) a1 = (PI * 2) - ( (2* PI * ( p / 100.0)) - (PI / 2) );
else if (p <= 75 ) a1 = (PI * (3/2) ) - ( (2* PI * ( p / 100.0)) - (PI / 2) );
else a1 = (PI) - ( (2* PI * ( p / 100.0)) - (PI / 2) );
a2 = atan(y/x) ;
if(isInside (make_pair(x,y)) ){
if( p <= 25){
if( a2 >= a1 && a2 <= a0) res = 1;
}
else {
if ( a2 >= a1 || a2 <= a0) res = 1;
}
}
printf("Case #%d: %s\n", c, res ? "black" : "white");
c++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.