Last active
August 29, 2015 14:14
-
-
Save AgrYpn1a/91633328e40c3ef8101f to your computer and use it in GitHub Desktop.
This file contains 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 <iostream> | |
#include <vector> | |
#include <cmath> | |
using namespace std; | |
int checkDot(long x, long y) { | |
long tempX; | |
// ako tacke nemaju nule | |
if (x<0 || y<0) { | |
tempX = abs(x); | |
if ((tempX+y) % 4 == 0) | |
return true; | |
} | |
if (x>0 && y>0) | |
if (((x+y)-2)% 4 == 0) | |
return true; | |
// ako tacke imaju nule | |
if ((y==0 && x%4 ==0) || (x==0 && y<0 && y%4==0) || ((x==0 && y>2 && (y-2)%4 == 0) || (y==2))) | |
return true; | |
return false; | |
} | |
int main() | |
{ | |
unsigned int q; | |
long x,y; | |
vector<bool> results; | |
cin >> q; | |
for (unsigned int i=0; i<q; i++) { | |
cin >> x >> y; | |
results.push_back(checkDot(x, y)); | |
} | |
for (vector<bool>::iterator it=results.begin(); it!=results.end(); ++it) | |
cout << ((*it)? "DA" : "NE") << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment