当前位置:   article > 正文

A. Find Color

a. find color
A. Find Color
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Not so long ago as a result of combat operations the main Berland place of interest — the magic clock — was damaged. The cannon's balls made several holes in the clock, that's why the residents are concerned about the repair. The magic clock can be represented as an infinite Cartesian plane, where the origin corresponds to the clock center. The clock was painted two colors as is shown in the picture:

A. Find Color - NGUNAUJ - NGUNAUJ

The picture shows only the central part of the clock. This coloring naturally extends to infinity.

The balls can be taken to be points on the plane. Your task is to find the color of the area, damaged by the given ball.

All the points located on the border of one of the areas have to be considered painted black.

Input

The first and single line contains two integers x and y — the coordinates of the hole made in the clock by the ball. Each of the numbers xand y has an absolute value that does not exceed 1000.

Output

Find the required color.

All the points between which and the origin of coordinates the distance is integral-value are painted black.

Sample test(s)
input
-2 1
output
white
input
2 1
output
black
input
4 3
output
black
s
/* ***********************************************
Author :
Created Time :2015/6/15 2:56:21
File Name :7.cpp
************************************************ */

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 1<<30
#define maxn 10000+10
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;

bool cmp(int a,int b){
return a>b;
}
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
int x,y;
while(cin>>x>>y){
if(x==0||y==0){
puts("black");continue;
}
if(x*y>0){
int d=x*x+y*y;
for(int i=0;i<=2000;i++){
if(d==i*i){
puts("black");break;
}
else if(d>i*i&&d<(i+1)*(i+1)){
if(i&1)puts("white");
else puts("black");
break;
}
}
}
else{
int d=x*x+y*y;
//cout<<sqrt(d)<<endl;
//cout<<d<<endl;
for(int i=0;i<=2000;i++){
if(d==i*i){
puts("black");break;
}
else
if(d>i*i&&d<(i+1)*(i+1)){
if(i&1)puts("black");
else puts("white");
break;
}
}
}
}
return 0;
}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/71581
推荐阅读
相关标签
  

闽ICP备14008679号