Skip to content

Instantly share code, notes, and snippets.

@AgrYpn1a
Last active August 29, 2015 14:14
Show Gist options
  • Save AgrYpn1a/91633328e40c3ef8101f to your computer and use it in GitHub Desktop.
Save AgrYpn1a/91633328e40c3ef8101f to your computer and use it in GitHub Desktop.
#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