A New Restaurant
All submissions for this problem are available.
Chef opens a new restaurant in the city of Byteland which can be represented in x-y plane. Chef’s restaurant is at point R(0,0). All the (x,y) points in Byteland where x and y both are integers represent a building. One fine day, Chef wants to know the number of buildings which are exactly D unit away from chef restaurant.
- First line contains a number T, number of test cases. Each of the next T line contains a number D
For each test case print the number of buildings which are exactly D unit away from (0,0).
Input: 1 1
Example case 1.There will be 4 points at a distance of 1 unit from Chefs restaurant, these are (1,0), (-1,0), (0,1), (0,-1)
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.