IOPC_14A - Fun with flooring factorial
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.
|
|
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.
|
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 |