Octal LooksProblem code: CE05 |
Write a program to find the number of set bits in the binary representation of a decimal number and print its ouptut in the proper coded format as given by the test cases below.
Input
You need to enter a natural number
Output
Output should be the number of set bits in the binary notation of the number
Example
Input:5
34
654
64
245
Output:
10
24
4
30
20
| Author: | cerebration |
| Date Added: | 23-03-2010 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | BF, CLOJ, CPP 4.3.2, F#, GO, ICK, JS, PERL6, PRLG, PYTH 3.1.2, TEXT, WSPC |
Comments

Fetching successful submissions

Can you explain what are set
Can you explain what are set bits??
is the sample test data
is the sample test data correct ? plz check it.
yah i think the sample output
yah i think the sample output is wrong.just stick to problem statement i think its easy to sort it out :D
u mean v just need to print
u mean v just need to print the no of set bits in the decimal representation ? even dat doesnt works..
hey tmdada...plz reply.
hey tmdada...plz reply.
Can any one of u please
Can any one of u please explain the problem clearly... Really not getting any clue about it ....
please help . . .
The sample outputs are
The sample outputs are completely wrong :P
just do what the statement tells you to do :D
can someone explain how for
can someone explain how for sample input 5 output is 10,,
and if its wrong what is the correct answer
Manoharprabhu hey is correct
Manoharprabhu hey is correct answeer for the test cases can you please reply
@Manohar prabhu whats the
@Manohar prabhu
whats the proper coded format here ? Is it just the no of set bits in decimal system ?
admins, plz correct the
admins, plz correct the sample test data..
SITZ plz can u tell wheter
SITZ plz can u tell wheter the octal program test case is correct or not
those who have solved the
those who have solved the question can anyone respond ???
give answeers to the input test cases
Hi There is no problem in the
Hi
There is no problem in the question,please look at the question name and the statement carefully,especially the last part of the problem statements.
Regards
Rohan Garg
@ rohan ..can u plz explain
@ rohan ..can u plz explain the sample test cases?
somebody please clear out any
somebody please clear out any of the test case please????
Ok ive corrected
Ok ive corrected everything,now you should know there is one more step before encoding the output.Also those who have already solved it please do not give out the answers as it hits your own chances of winning,we have a limited number of problems
Thanks
Rohan Garg
Hi the new problem reads as
Hi the new problem reads as follows
Write a program to find the number of set bits in the binary representation of a decimal number and print its ouptut in the proper coded format as given by the test cases below.
Input
The first line consists of number of test cases and next lines consist of the number to be coded.
Output
Output should be the number of set bits in the binary notation of the number
Example
Input:5
34
654
64
245
23
Output:
10
24
4
30
10
@ALL Please take T test cases
@ALL
Please take T test cases as input first.
Then take T number of inputs and output the number of set bits in its binary representation.
Input: 5346546424523 Output:
Input:
5
34
654
64
245
23
Output:
2
5
1
6
4
------------------------
This is the correct output
Ok in the last post please
Ok in the last post please replace the last 10 in the output with 20
hey rohan plz check out
hey rohan plz check out whether the output given by u is correct.....the output of Manohar seems correct but is not accepted?????
@ankit output is correct,
@ankit
output is correct, just read the comments posted above
i am submitting according to
i am submitting according to the output of manohar but its not accepting???
is the number to be coded a
is the number to be coded a Natural Number????
plz specify....
@Ankit Are you printing all
@Ankit
Are you printing all the results in a newline?
@Manohar yes i am printing
@Manohar
yes i am printing the results in new lines...
and are the test cases natural numbers only???
@ankit hey ankit...dont go
@ankit
hey ankit...dont go with manohar's o/p....dats incomplete. Rohan's new test data is correct.
:P :P ok .. do as you wish :D
:P :P ok .. do as you wish :D
@Kushagra Gour By the way,
@Kushagra Gour
By the way, can you explain how 34 has 10 set bits according to sample output?
@Manohar prabhu Pleas note
@Manohar prabhu Pleas note that ive encoded the output,so you need to look carefully and work it out.
Please do not discuss the solutions as this will hamper your own progress.
The new sample i/p and o/p is absolutely correct
@All yes the numbers are
@All yes the numbers are supposed to be natural numbers,the test cases have been designed keeping this in mind
What will be the o/p for 56?
What will be the o/p for 56?
Anyway, my solution has been
@Rohan Garg as u r saying
@Rohan Garg
as u r saying that
Input:
5
34
654
64
245
23
Output:
10
24
4
30
10
r absolutely correct then
WHY MY PROGRAM IS NOT ACCEPTED THOUGH IT IS GIVING SAME O/P
can u please provide 1 or 2 more test case so that every one can get their doubts seeing those test cases
@mukesh the last one is
@mukesh
the last one is correct
no more hints as this will be the deciding question of the competition
I meant the last O/P given by
I meant the last O/P given by rohan is correct(except that it is 20 for 23 not 10 as mentioned above)
I visited Mohan Prabhu's
I visited Mohan Prabhu's profile.. and there... CE05 is not shown as solved by him.... :-( ... a bit of confusion in the ranking.... might be some technical issues during him submission time... CE05 works with Rohan Garg's description.. and.. Rohan is the coordinator of this event i think.. so definetly he is correct!!! @ mohan visit your profile.. and... check.. for CE05!!! there are others also with points 7 and.. their profile showing.. just 6 solved for this event!!! :-0 .. i too had to resubmit a solved problem to make it to 7... :-(
@Admin: I have solved all the
@Admin: I have solved all the 7 questions and my profile verifies it too... but my score still is 6..
please recheck the ranks and correct the technicalities there, if any..
thnx...
@ Rohan Garg hey man please
@ Rohan Garg
hey man please reply to me post
also please reply
what should b output of 56
abe kya natak laga
abe kya natak laga rakha
suno yaar tumhe pahele batana chahiye tha ya email karna chahiye tha
this is not fair with us.
I spent my whole day for solving these problems now you are saying you haven't registred.
sending information of this much value throungh comment is not good.
please be fair in judging.
:(
:(
:(