Chef and his device
All submissions for this problem are available.
For a partiular task, Chef requires a device consisting of N gears, circularly linked to each other. Your task is to find whether N gears can simultaneously rotate clockwise or anticlockwise.
- First line of the input has an integer T. T test cases follows.
- Each test case has a single integer N, the number of gears.
For each test case, on a single line output 'Y' if all gears can rotate simultaneously, or 'N' if that is not the case.
- 1 ≤ T ≤ 100
- 3 ≤ N ≤ 103
Input: 2 4 5 Output: Y N
4 gears can rotate simultaneously.
5 gears cannot rotate simultaneously and will be locked
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.