Vote count

Discuss about the puzzles, but without giving the solutions please !!!

Vote count

Postby admin » Fri Jul 01, 2011 7:01 am

The purpose of this puzzle is to count the number of votes assigned to a given set of choices and to determine the winner (the choice with the most votes) and the percentage of votes it received.


If several options have the maximum number of votes they should be displayed in alphabetical order.



User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Vote count

Postby Joydeep Mondal » Fri Jul 01, 2011 9:57 pm

I think in the example there is an error.....the input file containing the choice count the coffee should have the count 35 instead of having 10....
User avatar
Joydeep Mondal
 
Posts: 9
Joined: Fri Jul 01, 2011 7:00 am

Re: Vote count

Postby David Berthelot » Sat Jul 02, 2011 1:10 am

There are two bags of coffee, one with 10 votes, one with 25.
So that amounts to a total of 35.

Did you miss the last bag ?
User avatar
David Berthelot
 
Posts: 43
Joined: Sun Jan 16, 2011 5:06 pm

Re: Vote count

Postby protocolocon » Sat Jul 02, 2011 5:43 am

I think spaces, tabs and newlines used inside " " or ' ', should be penalized as the rest of characters (admin, want to avoid repeating my Word mangle mini best ruby solution)...
User avatar
protocolocon
 
Posts: 8
Joined: Sat Jan 22, 2011 4:36 am

Re: Vote count

Postby David Berthelot » Sat Jul 02, 2011 8:51 am

Wouldn't that penalize python incredibly ? Its syntactic structure is based on indentation.
User avatar
David Berthelot
 
Posts: 43
Joined: Sun Jan 16, 2011 5:06 pm

Re: Vote count

Postby protocolocon » Sat Jul 02, 2011 9:15 am

David Berthelot wrote:Wouldn't that penalize python incredibly ? Its syntactic structure is based on indentation.


Only the spaces, tabs and newlines which are part of strings, that is, enclosed by " " or ' '. The rest of space characters, including indentation, would remain free of charge.
User avatar
protocolocon
 
Posts: 8
Joined: Sat Jan 22, 2011 4:36 am

Re: Vote count

Postby admin » Sat Jul 02, 2011 11:57 am

Your proposal makes sense protocolocon, however that's pretty tricky to catch strings for every language. Because each has a way to declare strings in special ways. For example, the triple-quotes in Python, the named delimiter in PHP.

May be in the end, the simplest short-term fix to avoid the trick you're referring to would be to count spaces, tabs and newlines since now every language has its own ladder anyway. Do you see any shortcomings in doing that ?
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Vote count

Postby protocolocon » Sat Jul 02, 2011 1:02 pm

Ranking by file size for each language makes sense to me.

The language partitioning makes the contest fairer as anyone can try to catch the points in his preferred language. Without the trick, I think that even C++ solutions can get pretty close to even ruby :roll:
User avatar
protocolocon
 
Posts: 8
Joined: Sat Jan 22, 2011 4:36 am

Re: Vote count

Postby admin » Sat Jul 02, 2011 1:49 pm

Yes I agree, the scoring has been modified accordingly and all previous submissions scores have been updated to the new scoring. Thanks for your feedback.
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Vote count

Postby Youssef Gamil » Mon Jul 04, 2011 1:07 pm

How come this is incorrect?!
"ERROR(incorrect): Incorrect result
Your submission failed to give the exact answer on the verification test. Please verify your code.
For reference, you program generated these results:
Coffee 43.76
Tea 43.76"
User avatar
Youssef Gamil
 
Posts: 1
Joined: Mon Jul 04, 2011 1:06 pm

Next

Return to Puzzles

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron