IOPC_14A - Fun with flooring factorial

no tags 

In a class of B students, the teacher wishes to distribute N! [Factorial(N)] oranges, such that each one of them gets equal number of oranges.

The teacher, being a lazy person, wants to give away oranges such that she has to take minimum number of them back with her.

Your job is to help the teacher to determine, given N and B, whether the number of oranges received by each student is even or odd.

Input

First line contains T, the number of test cases. Next T lines follow, each line containing two space separated integers N and B.

Output

The output should contain T lines, one for each test case. If the output of a test case is even print "Even" (without quotes), otherwise print "Odd".

Constraints

  • N ≤ 105
  • 0 < B ≤ 1018
  • 0 < T ≤ 100

Example

Input:
2
3 6
2 1

Output:
Odd
Even

hide comments
Francky: 2014-03-02 20:03:34

1) It seems brute force solutions are accepted, although a log(N)+log(B) solution exists. Constraints should be harder.
2) Are IO correct ? Or I misunderstood the problem (tell if (N!)/B is Odd or Even , ie divisible by two)?

Re : 1) May be you have a better solution.
2) IO is correct. it can be divisible . IF it is not mentioned , please do not assume anything.

--ans(francky)--> "Odd" "Even" refer to divisibility by two. If it's not the case in your problem, please clarify the description with another example.

Re : Please read the problem statement again !
--ans(francky)--> I did, I saw no changes ; understandable for me. What is the question, clearly ?

Re : I can't do this , It's not my problem if you cannot understand the problem. The problem had 71 odd correct submissions with the same problem language. I won't spoil my problem.
--ans(francky)--> I think I understand the problem, and that IO are wrong. Please give me a counter example.

Re: 3! = 6 , 6 orages in 6 students , such that she carries minimum oranges back and distribute each student equally --> 1 orange to each student --> 1 is Odd. I do not know what have you really understood and what counter example are you looking for.
--ans(francky)-->A counter example where my code fail, I would be very surprised.

Re: Have you ever seen at spoj that problem setter is telling the person the test case in which he/she is getting wrong. Stop Kidding , if you cannot solve the problem , move ahead !
--ans--> I am very confident with my solution. I still think your IO are wrong. Bye.
Re : Bye

Last edit: 2014-03-02 21:00:55
Francky: 2014-03-02 19:50:35

As the IOPC_14 problems have a "solution" web accessible ; to not disturb the ranking system ; those problems are moved to tutorial. Such problems can't share those two places imho. Author should have chosen only one kind. Public solutions accessible, or not.

RE: Why have you moved to tutorials the unsolved problems. Do not misuse your power .
--ans(francky)--> Do we have to check each hour if a solution is posted and accessible ? Of course not. It's obvious.

Last edit: 2014-03-02 20:36:05

Added by:devu
Date:2014-03-02
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Setter: Rachit Nimavat| Tester: Devendra Agarwal, Praveen Dhinwa| Writter : Vijay Keswani