Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(void){
	while( true ){
		int n;
		double x,y,z;
		
		cin >> x >> y >> z;
		if( x==0&&y==0&&z==0 ) break;
		cin >> n;

		for(int i = 0; i < n; i++){
			int r;
			cin >> r;
			if( (x*x/4)+(y*y/4) < r*r ||
				(x*x/4)+(z*z/4) < r*r ||
				(y*y/4)+(z*z/4) < r*r ) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
int r[100];
int n=0;

while(true){
	int temp;
	cin>>temp;
	if(n>=2&&temp==0&&r[n-1]==0&&r[n-2]==0){
		break;
	}
	else{
		r[n]=temp;
		n=n++;
	}
}
	int rec1,rec2,rec3;
	rec1=sqrt(a*a+b*b);
	rec2=sqrt(a*a+c*c);
	rec3=sqrt(b*b+c*c);


	for (int i=0;i<n;i++){
	 if (2*r[i]>rec1||2*r[i]>rec2||2*r[i]>rec3){
		 cout<<"OK"<<endl;
	 }
	 else{
		 cout<<"NA"<<endl;
	 }
	}
return 0;

}

C++: #include <iostream>
#include <vector>
#include <algorithm>

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> x;
  size[0] = x;
  std::cin >> x;
  size[1] = x;
  std::cin >> x;
  size[2] = x;
  std::sort(size.begin(), size.end());
  
  while(size[0]==0 && size[1]==0 && size[2]==0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std::cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
    std::cin >> x;
  size[0] = x;
  std::cin >> x;
  size[1] = x;
  std::cin >> x;
  size[2] = x;
    std::sort(size.begin(), size.end());
  }
  
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

int main(){
  vector<int> size;
  int x, n, r;
  
  std::cin >> size[0];
  std::cin >> size[1];
  std::cin >> size[2];
  size.sort(size.begin(), size.end());
  
  while(d!=0 && w!=0 && h!=0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std;;cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
  }
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#define PI 3.14159265358979323846264

using namespace std; 



int main(void){

	int n;
	double v,box_area[5],height,width,depth,min_area;
	
	vector<double> hole;
	vector<double> hole_area;
	
	while(1){
	
		height=0;
		width=0;
		depth=0;
		n=0;
		min_area=0;
		
		hole.clear();
		
		hole_area.clear();

		for(int i=0;i<5;i++){
			box_area[i]=0;
		}
		
		scanf("%lf %lf %lf",&height,&width,&depth);
		
		if(height==0 && width==0 && depth==0){
			break;
		}
		
		scanf("%d",&n);

		for(int i=0;i<n;i++){
			cin>>v;
			hole.push_back(v);
		}

		for(int i=0;i<n;i++){
			hole_area.push_back(hole[i]*2.0);
			//printf("hole_area[%d]=%lf\n",i,hole_area[i]);
		}

		box_area[0]=sqrt(1.0*height*height+1.0*width*width);	//¼ûÌÌ3ÊÌ»ê¼êÌÎpü
		box_area[1]=sqrt(1.0*height*height+1.0*depth*depth);
		box_area[2]=sqrt(1.0*width*width+1.0*depth*depth);

		/*for(int i=0;i<3;i++){
			printf("box_area[%d]=%lf\n",i,box_area[i]);
		}
		printf("hei=%lf wid=%lf dep=%lf\n",height,width,depth);*/
		
		min_area=min(box_area[0],min(box_area[1],box_area[2]));
		
		//printf("¼ûÌÌÅ¬ÊÏÍ:%lf\n",min_area);

	
		for(int i=0;i<n;i++){
			
			if(hole_area[i]>min_area){
				printf("OK\n");			
			}
			else{
				printf("NA\n");	
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int a[3];
	while(cin>>a[0]>>a[1]>>a[2]&&(a[0]||a[1]||a[2]))
	{
		sort(begin(a),end(a));
		int n;cin>>n;
		int l=a[0]*a[0]+a[1]*a[1];
		
		for(int i=0;i<n;i++)
		{
			int k;cin>>k;
			k*=2;
			k*=k;
			cout<<(l>=k?"NA":"OK")<<endl;
			
		}
	}
	
	
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

void solve()
{
	vector<int> size(3);
	while(cin >> size[0] >> size[1] >> size[2], size[0] || size[1] || size[2])
	{
		sort(size.begin(), size.end());
		double diagonal = sqrt((double)size[0] * size[0] + size[1] * size[1]);
		int n;
		cin >> n;
		for(int i = 0; i < n; ++i)
		{
			int a;
			cin >> a;
			if(2 * a > diagonal)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: 

#include<iostream>

using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;
int n;
while(cin >> w >> h >> d){
cin >> n;
while(n--){
cin >> r;
s=r*r*pi;
if(w*h<s||h*d<s||d*w<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int length, width, height;
	while(cin >> length >> width >> height)
	{
		if(!length && !width && !height)
		{
			break;
		}
		int max = length;
		if(max < width)
		{
			max = width;
		}
		if(max < height)
		{
			max = height;
		}
		max /= 2;
		int n;
		cin >> n;
		while(n--)
		{
			int size;
			cin >> size;
			if(max < size)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: //Name: Carry a Cheese
//Level: 2
//Category: 数学,幾何
//Note:

/**
 * 直方体のどれかの面をまっすぐ入口に押しこむように入れるのが最適。
 * このとき、入口に平行な面の対角線の長さが、入口の直径よりも小さければ運び込むことができる。
 * 浮動小数点数を使うと誤差が怖いので、長さを2乗して扱うことで整数で判定する。
 *
 * オーダーは O(N)。
 */
#include <iostream>
#include <algorithm>

using namespace std;

bool solve() {
    long long A, B, C;
    cin >> A >> B >> C;
    if(!A && !B && !C) return false;

    const long long diag = min({A*A+B*B, A*A+C*C, B*B+C*C});
    int N;
    cin >> N;
    while(N--) {
        long long R;
        cin >> R;
        cout << (4*R*R > diag ? "OK" : "NA") << endl;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    while(solve()) ;
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int d, w, h;
  while (cin >> d >> w >> h, d) {
    if (d < w) swap(d, w);
    if (w < h) swap(w, h);
    if (d < w) swap(d, w);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      int r;
      cin >> r;
      cout << (w * w + h * h < 4 * r * r ? "OK" : "NA") << endl;
    }
  }

  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    double x, w, h, n, r, min_r;
    while (cin >> x >> w >> h, x || w || h){
	min_r = min(sqrt(x*x+w*w), min(sqrt(x*x+h*h), sqrt(w*w+h*h)));
	cin >> n;
	while (n--){
	    cin >> r;
	    r*=2;
	    min_r < r ? cout << "OK" << endl; : cout << "NA" << endl;
	}
    }
}