Search found 9 matches

by zack
Sun Oct 19, 2003 8:22 pm
Forum: Volume 6 (600-699)
Topic: 694 - The Collatz Sequence
Replies: 46
Views: 21954

Just fixed the problem related to the wrong output in those test cases (checking a > l too soon).

Still gets TLE anyways.

Using
while not eof (input) do

as...

input line one
-- output result
input line two
-- output result
input ...
-- output result

Also tried while a > 0 TLE also.
by zack
Sun Oct 19, 2003 7:54 pm
Forum: Volume 6 (600-699)
Topic: 694 - The Collatz Sequence
Replies: 46
Views: 21954

694 output

Working on 694. Running locally, the output isn't the expected (as presented on the problem descrip. page). Some examples:

3 100
expected: 8
program: 8

34 100
expected: 14
program: 14

75 250
expected: 3
program: 4 WRONG

101 304
expected: 26
program: 26

101 303
expected: 1
program: 2 WRONG

Also ...
by zack
Sun Oct 19, 2003 5:27 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318271

I don't understand why my code doesn't work. :cry:
I keep getting WA. Can you see anything wrong? :o

[c]


if( i > j ) {
k = i;
i = j;
j = k;
}

for(k = i ; k <= j; k++) {
length = cycleLength(k);

if( length > max ) {
max = length;
}
}
printf("%d %d %d\n", i, j, max);
}

return 0 ...
by zack
Sun Oct 19, 2003 4:36 pm
Forum: Algorithms
Topic: Find the simplest...
Replies: 3
Views: 2243

What are the recommend readings to learn about weighted graphs? Thanks.
by zack
Wed Oct 15, 2003 2:08 am
Forum: Algorithms
Topic: Find the simplest...
Replies: 3
Views: 2243



I'm assuming that the maze is static though and you use the term "moved" to try to rationalize why each square has a cost (with respect to the original problem description that has lots of extraneous information).



Yes. It's like monopoly: when you hit squares you pay the rent :p and some are ...
by zack
Wed Oct 15, 2003 1:24 am
Forum: Algorithms
Topic: Find the simplest...
Replies: 3
Views: 2243

Find the simplest...

Hi.

Imagine there's somekind of maze and you need to find the best way to go from point A to point X.

How can/should the problems like that be aproached?

Example:

A guy needs to go from A to X. Between those two points there are two types
of obstacles * and "." He can go in any direction ...
by zack
Sun Oct 12, 2003 3:29 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318271

Got AC. Using integer. Wasn't checking i <= j just i < j.
by zack
Sun Oct 12, 2003 2:33 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318271

In the pascal info page at http://acm.uva.es/problemset/pascal.html they say that "longint" isn't to be used.

I'm using free pascal to compile and the only way to get the program working with bigger numbers ( the 900 1000 input, for example) is to use bigint.

The code outputs the correct result ...
by zack
Sun Oct 12, 2003 2:13 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318271

Re: Always WA in 100 [Pascal]

OmShanti wrote:I don't know what is wrong:[pascal]program program100;
const
Niesk=0;
var
tab: array[1..1000000] of qword;

i,j,k,h,p: longint;
max,printed: qword;

[/pascal]
In http://acm.uva.es/problemset/pascal.html it says
Do NOT use LongInt type!
Can that be the reason for the error?

Go to advanced search