Search found 7 matches

by gagern
Thu Apr 06, 2006 3:38 pm
Forum: Volume 110 (11000-11099)
Topic: 11019 - Matrix Matcher
Replies: 43
Views: 17863

OK, yes, I could use other functions as well. I just adapted the code from Cho: #include <stdio.h> #include <string.h> #include <stdlib.h> char txt[1024][1024], ptn[1024][1024]; int main() { int M, N, Y, X, T, i; int len, zero = 0, *nullpt = 0; for(scanf("%d", &T); T--; ) { scanf("%d %d\n", &M, &N);...
by gagern
Thu Apr 06, 2006 1:46 pm
Forum: Volume 110 (11000-11099)
Topic: 11019 - Matrix Matcher
Replies: 43
Views: 17863

Input format

I fear there is something wrong with the input. I wrote a program that reads a whole matrix definition in one call to fread. But no matter if I assumed exactly one newline following the matrix size, or used gets to first read to the end of the line with the dimensions, or had scanf skip all whitsepa...
by gagern
Thu Sep 01, 2005 3:25 pm
Forum: Volume 108 (10800-10899)
Topic: 10853 - Pablito nailed a nail
Replies: 10
Views: 3326

I had a lot of WA today, too. Did you try with unsigned (C, C++) or long (Java)? This solved the problem for me.
by gagern
Thu May 06, 2004 10:18 pm
Forum: Volume 100 (10000-10099)
Topic: 10061 - How many zero's and how many digits ?
Replies: 43
Views: 21068

I have a Program using natural logarithm that gets accepted.

But I have to apply a little bit of correction, because when the actual result is very close to an integer, numeric error might lead to the number being actually rounded to an integer one too small. So I add 1e-14 and it works.
by gagern
Wed Apr 14, 2004 6:49 pm
Forum: Volume 100 (10000-10099)
Topic: 10061 - How many zero's and how many digits ?
Replies: 43
Views: 21068

I did so and together with Carlos we found that lgamma is not part of ANSI C and was therefore not declared, so my program tried to pass the parameter as an integer. That happens if you don't compile with "-ansi -Wall"...
by gagern
Wed Apr 14, 2004 6:45 pm
Forum: Volume 103 (10300-10399)
Topic: 10395 - Titans in Danger
Replies: 18
Views: 3146

See also Topic 1866.

I also tried this simple recursion:

Code: Select all

perm(0): output current
perm(i): perm(i-1);
         for j=1 to i: swap 0 and i;
                       perm(i-1);
Result: some permutations occur several times, up to 36. Thus others must be missing.

Greetings!
by gagern
Thu Mar 11, 2004 6:03 pm
Forum: Volume 100 (10000-10099)
Topic: 10061 - How many zero's and how many digits ?
Replies: 43
Views: 21068

10061 Test case correct?

Hello! First thing: after the following code I'm going to discuss different solution strategies, so if you want to think for yourself, please don't read on. But this code is fine to use, since it is way too slow for the judge. But it does create exact results, since it really calculates the factoria...

Go to advanced search