Skip to content

Instantly share code, notes, and snippets.

@Leko
Created June 8, 2013 15:38
Show Gist options
  • Save Leko/5735539 to your computer and use it in GitHub Desktop.
Save Leko/5735539 to your computer and use it in GitHub Desktop.
AOJ 0107 Carry a Cheese Time Limit : 1 sec, Memory Limit : 65536 KB
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
int main() {
int n;
vector<int> s(3);
while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
sort(s.begin(), s.end());
// REP(i, 3) cout << s[i] << " ";
// cout << endl;
double size = sqrt(s[0] * s[0] + s[1] * s[1]);
// cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;
REP(i, n) {
double r;
cin >> r;
// cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
if ( r * 2 <= size )
cout << "NA";
else
cout << "OK";
cout << endl;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment