HLP_RAMS - Topper Rama Rao

no tags 

Rama Rao is the topper of his branch. One of his friends was jealous of it. So, he poses a question to test Rama Rao and is as follows:

For a given n, find the number of even and odd numbers among the set, { nC0, nC1,... nCn }.

Rama Rao was having hard time solving it. He hopes you can help him.


First line contains t( 1<=t<=105), the number of test cases. Next t lines contain one integer per line, denoting n(0<=n<=1012)


For each test case, output two space separated integers specifying the number of even numbers and odd numbers respectively.



0 4
3 2
 for 3, values are: 1 3 3 1. All are odd. Hence 0 4
 for 4, values are: 1 4 6 4 1. Hence 3 2

hide comments
Mitch Schwartz: 2014-03-08 17:54:53

A golfing version might be better for SHORTEN than for challenge section. And for such a version, I wouldn't restrict source code limit too much; sometimes it's fun to golf in languages that aren't as good for golf, such as Java or BF. I'm at 49 47 46 bytes in AWK.

--nitish--> But I dont have appropriate permissions to put on SHORTEN!

(Mitch) For SHORTEN, you can prepare the problem, making sure "Available for use in 3rd party contests" is checked, then ask Piotr KÄ…kol to please review it and add it if he feels it will be suitable, or give suggestions on how to improve it, etc. I've sent you an email with his email address. :)

Last edit: 2014-03-09 19:31:22
Francky: 2014-03-08 15:44:16

This problem shouldn't move imho. But another one in challenge could be possible. But I see several problems, the most important is : it's way too IO dependent, among other problems ... and in fact, I think it's nice as it is.

Apoorv Jindal: 2014-03-08 14:41:43

@nitish rao I guess the CHALLENGE section will suit this problem better as the fun is really only in its implementation. The algorithm is either trivial or readily available on the net.Consider moving it to the CHALLENGE section. A strict source limit maybe 80-100 B and a strict time limit would make this problem fun to solve. Please, consider moving it to CHALLENGE section. :)

Bhavik: 2014-03-07 14:17:54

once again nice way of presenting the problem:)

Added by:nitish rao
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:My own Problem