Search found 96 matches

by Picard
Sat Sep 28, 2002 5:19 pm
Forum: Pascal
Topic: input problem
Replies: 12
Views: 12704

i think you should be careful about read and eof . example in this case after the last read there is still a newline char in the input, and eof will still return false, but the next read will raise an exception (that will cause runtime error if not caught) btw i'am not using pascal, but it's not rea...
by Picard
Sat Sep 28, 2002 6:59 am
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 31039

the input reading has an error. after the last 'c'/'q' line you read into the next input block because scanf("\n") reads more newline chars (and the next "scanf("%d\n",&n);" will fail). i used (instead of the two scanf("%c ...) [cpp]char s[256]; while (gets(s) && sscanf(s," %c %d %d",&c,&n1,&n2)==3)...
by Picard
Tue Sep 24, 2002 2:06 pm
Forum: Volume 103 (10300-10399)
Topic: 10358 - Matrix
Replies: 9
Views: 3399

sorry i can't help in this. i used kinda bruteforce (there are not too many states on a given board)
by Picard
Tue Sep 24, 2002 1:31 pm
Forum: Volume 103 (10300-10399)
Topic: 10301 - Rings and Glue
Replies: 50
Views: 16282

nope, (0.0 0.0 2.0) touches only (3.0. 2.0 2.0). (the rings have a hole inside, so only the perimeter counts)
i used '0 rings'
by Picard
Tue Sep 24, 2002 9:07 am
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 23132

please next time read the previous topics about the problem you are asking! you may found the answer there.

when taking the sum of two numbers, their difference should be positive, i. e. means >0. example 26 = 7+19 (not 13+13)
by Picard
Tue Sep 24, 2002 7:33 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 183014

the problem is not in cycle() (cycle(55)==113 is good). you repeat the last test case, use "while (cin >> i >> j)" instead. btw don't worry about integer overflow in cycle() the problem description states it won't happen.
by Picard
Mon Sep 23, 2002 1:11 pm
Forum: Volume 4 (400-499)
Topic: 424 - Integer Inquiry
Replies: 96
Views: 20052

char type has a -128..127 value range. you only deal with carry at the end, so it may happen that e[x] has value range overflow earlier (like in the example: 15*9=135 > 127)
by Picard
Mon Sep 23, 2002 8:40 am
Forum: Other words
Topic: Integral cast
Replies: 9
Views: 2872

i think only negative non integer numbers cause a difference. so (int)sqrt(value) and (int)floor(sqrt(value)) shouldn't ever be different (in valid range). integer casting only cuts the decimals: (int)-1.5=-1, but floor returns the largest integer that is less than or equal to the value: (int)floor(...
by Picard
Sun Sep 22, 2002 8:45 am
Forum: Volume 100 (10000-10099)
Topic: 10098 - Generating Fast
Replies: 62
Views: 13937

this problem is very similar to P195. i think they ment "Note that the...", but it doesn't really matter because in the judge's input there is no upper case letter.
( i used this short program: while ((ch=getchar())!=EOF) if (tolower(ch)!=ch) abort(); )
by Picard
Sat Sep 21, 2002 12:49 pm
Forum: Volume 103 (10300-10399)
Topic: 10322 - The Four in One Stadium
Replies: 7
Views: 2485

i get:

1.7750895846 0.1154579521 0.2394762157
3.5682482323 0.0842953628 0.1205519957
2.3783828932 0.1422255342 0.3610147806

(i didn't go after why is the difference and which one is actually correct, but i got accepted)
by Picard
Fri Sep 20, 2002 9:05 pm
Forum: Volume 100 (10000-10099)
Topic: 10004 - Bicoloring
Replies: 93
Views: 29417

from the problem desc:
"the graph will be strongly connected. That is, there will be at least one path from any node to any other node."
by Picard
Fri Sep 20, 2002 6:35 pm
Forum: Volume 100 (10000-10099)
Topic: 10004 - Bicoloring
Replies: 93
Views: 29417

zyzyis: it's probably too late, but you clear re[] array with Init() at every test case. btw why are you saving the result in re[]? why not print it right away? henar2: you can fill the graph (starting from any node, coloring to color1), fill all neighbours to the other color (recursivly). during fi...
by Picard
Fri Sep 20, 2002 6:08 pm
Forum: Volume 103 (10300-10399)
Topic: 10358 - Matrix
Replies: 9
Views: 3399

what if trinity's path is not shorter? she may still escape (first example below). this algorithm takes only a little closer to the solution (when you can escape for sure, because you are closer to a phone as any agent), but how do you solve the problem in all other cases? (how do you know if you ar...
by Picard
Fri Sep 20, 2002 12:31 pm
Forum: Volume 103 (10300-10399)
Topic: 10342 - Always Late
Replies: 25
Views: 10986

you have to find another path which length is not minimum (but second smallest length)
by Picard
Fri Sep 20, 2002 8:25 am
Forum: Other words
Topic: compile error
Replies: 10
Views: 3473

it gets compiled to me (and wrong answer). you should compare the source with the "program received" email you got from the judge. maybe your mailer is messing up something in the source.

Go to advanced search