Search found 108 matches

by Maarten
Sat Dec 06, 2003 1:26 pm
Forum: Volume 105 (10500-10599)
Topic: 10578 - The Game of 31
Replies: 11
Views: 4879

That is exactly what you have to figure out in this problem! ;-) Perfect strategy means: If there IS a move that leads to a winning situation, you do that move, and no other. Imagine you are calculating all possible moves in the game, and determine if a move is winning, or loosing (or maybe undeterm...
by Maarten
Mon Nov 10, 2003 3:51 pm
Forum: Volume 4 (400-499)
Topic: 446 - Kibbles "n" Bits "n" Bits "n" Bits
Replies: 50
Views: 4444

What operating system / compiler do you use ? Mine doesn't fail at those cases.
Btw I use Editplus and it creates a template like the one above. That's why I define my main like that. It never gives me problem before.
by Maarten
Mon Nov 10, 2003 11:15 am
Forum: Volume 4 (400-499)
Topic: 446 - Kibbles "n" Bits "n" Bits "n" Bits
Replies: 50
Views: 4444

I get wrong answer on this problem too.. and I really don't understand why. I passed all the test cases above.. anything I forgot? Anyone please help me !! Here is my code: [cpp] #include <stdio.h> void binary( char *result, int n ) { int i; for( i=12; i>=0; i-- ) { result = '0' + (n & 1); n >>= 1; ...
by Maarten
Sun Nov 09, 2003 11:12 pm
Forum: Volume 101 (10100-10199)
Topic: 10127 - Ones
Replies: 32
Views: 12319

obayashi wrote:there's a simple solution;)
Does 'simple' mean O(1) solution? My solution is O(number of digits in result)
by Maarten
Sun Nov 09, 2003 3:12 pm
Forum: Volume 100 (10000-10099)
Topic: 10002 - Center of Masses
Replies: 59
Views: 26209

Btw, the definition of "Center of mass" is quite easy: Suppose you make the polygon out of wood (make it massive), and try to balance it on the tip of your finger. The center of mass is the single point where it will not fall off your finger. I think many people here are confused with the center of ...
by Maarten
Sun Nov 09, 2003 3:06 pm
Forum: Volume 100 (10000-10099)
Topic: 10002 - Center of Masses
Replies: 59
Views: 26209

bolster wrote:2) Sometimes, "-0.000" is probably displayed for small numbers that get rounded off, so must add some small value to all output.
This trick did it for me. I added some constant epsilon = 1e-15 to the final answer, and I got accepted right away.
by Maarten
Sun Nov 09, 2003 12:52 pm
Forum: Volume 105 (10500-10599)
Topic: 10578 - The Game of 31
Replies: 11
Views: 4879

hmm.. so it seems i'm completely wrong in my output... then i probably made a stupid mistake somewhere. Thanks for your help so far

-Edit-
Thanks, got accepted now. I made a really stupid mistake... they're usually the hardest to find :-(
by Maarten
Sat Nov 08, 2003 8:25 pm
Forum: Volume 105 (10500-10599)
Topic: 10578 - The Game of 31
Replies: 11
Views: 4879

10578 - The Game of 31

Hi everyone! I tried to do 10578 and was surprised to get WA... First of all I'm a little unsure how to handle the input.. for example if there is an empty line at the end of the input I should treat it as being a test case, right ? And what if there is a \n at the end of the last line but nothing e...
by Maarten
Fri Nov 07, 2003 9:10 pm
Forum: Volume 1 (100-199)
Topic: 119 - Greedy Gift Givers
Replies: 145
Views: 25051

don't just post your code but tell us the method you're using.
by Maarten
Fri Nov 07, 2003 1:21 am
Forum: Volume 8 (800-899)
Topic: 847 - A Multiplication Game
Replies: 41
Views: 19873

why 13123 makes Stan the winner?
My AC program makes Ollie the winner for 13123. In fact, I'd like to know very much your strategy to make Stan win. Wanna play a game of multiplication with n=13123? I will play Ollie, anyone volunteer to play Stan? :P
by Maarten
Thu Nov 06, 2003 6:23 pm
Forum: Volume 105 (10500-10599)
Topic: 10566 - Crossed Ladders
Replies: 39
Views: 11525

my program gives the same answers as yours. But how about these:

10 5 0
5 10 0
by Maarten
Thu Nov 06, 2003 11:04 am
Forum: Volume 100 (10000-10099)
Topic: 10032 - Tug of War
Replies: 91
Views: 31842

( 1 ) can you use formatting tags to post code?
( 2 ) can you explain your algorithm?
by Maarten
Thu Nov 06, 2003 1:07 am
Forum: Volume 105 (10500-10599)
Topic: 10566 - Crossed Ladders
Replies: 39
Views: 11525

what i meant to say is: You calculate fa and fb in your loop but you never use them anywhere in the program. So then why do you calculate them?
by Maarten
Tue Nov 04, 2003 9:57 pm
Forum: Volume 105 (10500-10599)
Topic: 10566 - Crossed Ladders
Replies: 39
Views: 11525

what's the purpose of your variables fa and fb ?
by Maarten
Sun Nov 02, 2003 6:25 pm
Forum: Volume 105 (10500-10599)
Topic: 10529 - Dumb Bones
Replies: 15
Views: 10813

I solved the problem.. but I'm still wondering how I can do faster. My current program runs in 2.578 seconds. The problem is indeed very interesting!

Go to advanced search