## Search found 67 matches

Wed Jun 15, 2005 9:32 am
Forum: Volume 107 (10700-10799)
Topic: 10774 - Repeated Josephus
Replies: 31
Views: 8207
I ran the code you posted against all possible inputs and it agreed with mine (I modified it so that it was in it's own function and then compared the output of that function with the output of mine). So I would assume that the error would be in your input/output. I typically use cin/cout so I can't...
Sun Jun 12, 2005 9:48 pm
Forum: Volume 107 (10700-10799)
Topic: 10774 - Repeated Josephus
Replies: 31
Views: 8207
Just to give you some inputs of larger cases:

Input:
11
5000
10000
15000
20000
25000
29995
29996
29997
29998
29999
30000
Output:
Case 1: 5 31
Case 2: 5 31
Case 3: 7 127
Case 4: 5 31
Case 5: 6 63
Case 6: 7 511
Case 7: 8 255
Case 8: 8 511
Case 9: 9 511
Case 10: 6 1023
Case 11: 7 127
Sun Jun 12, 2005 12:03 pm
Forum: Volume 107 (10700-10799)
Topic: 10774 - Repeated Josephus
Replies: 31
Views: 8207
Input: 27 1 2 3 4 5 7 8 9 15 16 17 30 31 32 33 34 60 61 62 63 64 65 66 67 100 256 512 Output: Case 1: 0 1 Case 2: 1 1 Case 3: 0 3 Case 4: 1 1 Case 5: 1 3 Case 6: 0 7 Case 7: 1 1 Case 8: 1 3 Case 9: 0 15 Case 10: 1 1 Case 11: 1 3 Case 12: 4 15 Case 13: 0 31 Case 14: 1 1 Case 15: 1 3 Case 16: 2 3 Case...
Tue Apr 26, 2005 8:05 pm
Forum: Volume 1 (100-199)
Topic: 135 - No Rectangles
Replies: 24
Views: 4652
Let A=k-1, and suppose you have an AxA grid and want to mark one point on each row, r, and one point on each column, c. If you write the pairs (r,c) then what you end up with is a permutation of the first A positive integers. In particular look at the cyclic permutations: I (the identity), (1,2,3......
Sun Apr 03, 2005 7:58 am
Forum: Volume 105 (10500-10599)
Topic: 10535 - Shooter
Replies: 25
Views: 48986
Yeah, that's the right answer. In my program, I assumed that it might be the case that walls can overlap or intersect (but since any wall gets destroyed as soon as the laser hits it any hidden walls become visible). Other than that there isn't anything I can think of. You can describe your algorithm...
Sun Apr 03, 2005 7:17 am
Forum: Volume 105 (10500-10599)
Topic: 10535 - Shooter
Replies: 25
Views: 48986
Here is the test case that tripped me up. If you draw it out you should see what the answer should be and why it might trip up your algorithm (especially if you were using my method).

Code: Select all

``````2
0 0 10 0
4 1 6 1
5 2``````
Sat Mar 12, 2005 6:16 pm
Forum: Volume 104 (10400-10499)
Topic: 10433 - Automorphic Numbers
Replies: 41
Views: 23399
I just wanted to clarify, if the number given is zero or one, then the judge considers it automorphic only if it has no leading zeros (in particular 0 and 01 are not an automorphic numbers). My program considers 1 to be an automorphic number, but I don't know if the judge has such a case.
Thu Mar 10, 2005 2:26 am
Forum: Volume 104 (10400-10499)
Topic: 10428 - The Roots
Replies: 13
Views: 9029
So I wrote up a solution involving finding the roots of f' and then binary searching within those, but still get WA. Can anyone give me the output for these cases? 5 1 -70.511 1760.474617 -18012.337703009 60153.7853143281 -2436.14759274839 5 1 -107.986 4547.329316 -92955.399977144 918279.594779019 -...
Sat Mar 05, 2005 7:33 pm
Forum: Volume 104 (10400-10499)
Topic: 10443 - Rock
Replies: 26
Views: 3917
For each string you're only allocating c characters. You need one more for the null terminator.

You also don't free the memory you malloc, so there's a leak.

I'd suggest using a static two dimensional array insead.
Thu Mar 03, 2005 7:14 pm
Forum: Volume 104 (10400-10499)
Topic: 10424 - Love Calculator
Replies: 137
Views: 39485
After running your code on a few different inputs, you didn't get any answer different than me, but yours did print out an extra line of input. You should check to make sure that at least two lines exist. It is a very bad habbit to check for end of file in programming contests, many beginners fail d...
Wed Mar 02, 2005 4:32 am
Forum: Volume 104 (10400-10499)
Topic: 10484 - Divisibility of Factors
Replies: 39
Views: 18795
Here's the correct output jamu. It appears you're off by one on cases where |d|=1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 2 0 2 1 0 0 0 0 1 0 0 2 2 4 0 4 2 2 0 0 1 0 0 480 880 0 242880 94133433139200 117666791424000 116177338368000 38603278909440000 38205306961920000 35101125771264000 39001250856960000 3900...
Wed Mar 02, 2005 1:30 am
Forum: Volume 104 (10400-10499)
Topic: 10487 - Closest Sums
Replies: 89
Views: 30283
Well, Antonio,

I think that your min is initialized to too small a value. Maybe the query number is really high and so the difference between sums and the query is large.
Thu Oct 28, 2004 3:14 pm
Forum: Volume 8 (800-899)
Topic: 834 - Continued Fractions
Replies: 20
Views: 12855
1. My program crashed on this input 2. If the first number is negative my program crashes, if the denominator is negative it outputs the same numbers as if the denominator was positive, except they are all negative also. From this I doubt that the judge's data includes true integers or negative numb...
Tue Oct 19, 2004 4:31 pm
Forum: Volume 7 (700-799)
Topic: 702 - The Vindictive Coach
Replies: 5
Views: 7913
Apparently I described it differently than I programmed it. It should be: a) If the captain is the shortest player on the team then 1) If he is the shortest player, then the order is obvious. 2) If there are two players total, then the second player goes next. 3) If there are three or more players, ...
Thu Sep 23, 2004 5:09 pm
Forum: Volume 8 (800-899)
Topic: 883 - Overlapping Rectangles
Replies: 0
Views: 1385

### 883 - Overlapping Rectangles

Just in case you were shocked and confused, the sample output should be:

Code: Select all

``````2 -4.50 -1.00
0
1 0.00 4.00
1 -5.00 -1.00
``````