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
praveen123: 2014-03-02 22:49:58

@Francky, I agree with your idea of having a different sections on spoj for problems which have their solutions available online.
I would also like to know what exactly you mean by "solution" being available in web. IMHO all the contests where organisers give their problems solutions codes should come under this category.

I would also like to point out one possible loss to spoj due to this change, as currently we dont have much problems being added on spoj which are truly following web policy you mentioned. So it will decrease the growth of classical section IMHO, which might significantly reduce number of users.

Last edit: 2014-03-03 00:12:47
Francky: 2014-03-02 22:30:43

Please see the forum. Thanks for your answers.
edit oops I've overwritten this old message.

Last edit: 2014-03-03 12:50:33
Blasters: 2014-03-02 21:50:57

I really dont understand why this problem has been put in the tutorial section . This is really a very good problem and really second rachit's comment

praveen123: 2014-03-02 21:49:15

^ Mitch About the particular issue of asking test case, I would say that Francky should have waited for some time for asking test data for the problem, as it might be possible that he might be making an error in his logic and problem writer did not want to point out him the error.

It is not always necessary that test data is wrong in this kind of cases, If many people point out there is some issue in the test cases, Then it can be handled.

Last edit: 2014-03-02 21:49:41
praveen123: 2014-03-02 21:42:15

Hi Mitch!!
I apologize to francky for the some harsh comments by Devendra Agrawal. Please understand that our protest is about the issue of problem being sent into tutorial, So I would like to know about your view on this issue particularly.

Last edit: 2014-03-02 21:44:44
રચિત (Rachit): 2014-03-02 21:37:00

I didn't upload this problem on SPOJ, but while creating it, we made a thorough checking of our solution by brute force and are very confident about the test files. We also took views of several people (all problem setters of IOPC 2014) regarding the interpretation. Also, on codechef, where it was hosted, many teams got it correct in their first attempt.

I cannot see the solution of Francky, but I would advise him to again read the question properly and verify his solution by a brute code. I have no idea about his O(logN+logB) solution, all I can say is: may be he has a better solution.

P.S : I am problem setter.

Last edit: 2014-03-02 21:37:26
Mitch Schwartz: 2014-03-02 21:22:26

When an experienced solver questions the correctness of test data, please consider a response such as "I double checked a case where your code gave a different answer from my sample solution, and" either "it turns out there was an error in the test data, and it is being fixed" or "it seems you have a bug in your program, please check again" or something similar. (The two alternatives are listed in no particular order.) I agree with the philosophy of "if you cannot solve the problem , move ahead" but in fact that response didn't match the context here; there's a difference between asking for spoilers and questioning correctness of test data. (Mistaking the one for the other might be the result of people having different native languages.) And let's not forget POWPOW -- same user questioning same problem setter ... remember who turned out to be right that time? Of course it could be different this time, everyone makes mistakes, but still, I am amazed by the condescending and dismissive language being used against Francky. The issue of problems on SPOJ that have public solutions posted elsewhere is separate and I have no comment on that at this time. Know also that hiding problems by changing placement in main problemset to "none" deletes all comments and can hinder communication in this way. Your protest also seems overly extreme to me, but I understand how things can feel very personal and uncomfortable in cases like this. As a general "fortune cookie" statement, also try to remember that we all have our own viewpoints; the way other people see things could matter as much as the way you see things.

Devendra : Hi Mitch , It is a disrespect to move our problems in tutorials. May be i have been agressive in answering the queries but this problem was used yesterday in the contest http://www.codechef.com/IOPC2014/problems/IOPC14A and it had submissions from various users and as you can see some of the accepted solutions tried here and they got it accepted which surely implies that test data are correct. And i really do not want to spoil my problem by revealing what exactly you have to do in it and the test case in which he might be failing.

Sorry Francky for my aggresive answers.

Last edit: 2014-03-02 21:33:39
praveen123: 2014-03-02 21:13:50

Contest organisers have taken a decision to hide all the problems until SPOJ editorial board (specially francky) clarifies its stands on the issue of moving the problems of this contest due to having its solution publicly accessible on web.
I have clarified my stand on the issue in another comment on this page itself. I would really want francky to reply on the issue as he has been pushing the idea of moving the problems into tutorial section. A thorough discussion needs to be done before implementing it.

As a protest to this situation, me and Devendra Agarwal have decided to not to add any problems on spoj until the situation is resolved.

Last edit: 2014-03-02 22:02:26
praveen123: 2014-03-02 20:21:33

^ Hi Francky: I can not really understand the reason of putting them into tutorial section, Tutorial section is to problems which have repeated idea or kind of duped problems. As you are saying that classical section can not have problems which solutions are available on the internet. I can even show you a LOT of problems on spoj which have solutions online available. Please re-assert your decision of making the problems of putting them in tutorial. A lot of ACM contests, codechef and codeforces contests problems are there on spoj. Lot of users have made their submission online, Then according to your logic, problem should be removed from classical section. Even spoj contests have public solutions, yet the problems being in classical section. Currently there are not many contests which dont have public solutions, So if work by this logic, number of problems in the upcoming contest will be reduced. If you insist on pushing this philospohy, please move all of them to tutorial.

--ans(francky)--> Tutorial is not a trash at all. It prevents only the trouble in ranking system. Bad problem are hidden. Here are maybe correct problems, but with an access to public solutions ; it's an issue. If I saw others I can move them too.

--ans(praveen123): I agree tutorial is not a trash. I will be really happy to know about your understanding of tutorial. If you want to push this thing as a philosophy remove all the problems which have this kind of issues. This is NOT the only one contest having such issue.
Do all the editorial board members agree with your philosophy, I STRONGLY doubt it because I know some of them have added problems in classical section of spoj when there solutions are publicly available. I have been doing spoj for long time, This is the first time I have seen this thing happening. I would recommend you to involve more people in process of deciding this idea for spoj. I believe that if you implement this philosophy so strongly, number of added problems to spoj will be very low.
I am also not wrong in my assertion of saying that tutorial section contains duped and repeated problems or problems with repeated idea, because it is so. You can see a lot of comment below the problems to move them into tutorial section and saying that they are too easy or a similar problem still exists in spoj.

Last edit: 2014-03-02 21:00:31

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