Page 1 of 1
10627 - Infinite Race
Posted: Fri Feb 27, 2004 10:46 am
by cyfra
Hi!
I tried to code this task on the contest but got WA.
Later I rewrote this task (this time without using any floats etc) and still got WA..
Does anyone have any tricky inputs for this task ??
Thanks in advance
Good Luck

Posted: Fri Feb 27, 2004 11:10 am
by Adrian Kuegel
You may have some overflow problems. Try this input:
1 2147483647 2147483647 2147483647
Posted: Fri Feb 27, 2004 11:35 am
by cyfra
Hi!
Thanks for answering ...
Adrian Kuegel wrote: Try this input:
1 2147483647 2147483647 2147483647
Unfortunately I use long long's for this and I don't think this may cause overflow problems..
My answer for this test is :
4611686014132420609
(Or is it wrong answer ??? )
Posted: Fri Feb 27, 2004 12:12 pm
by Adrian Kuegel
Ok, then here are a few other test cases:
10 10 1 10
10 10 1 11
10 10 1 30
10 10 1 31
5 4 2 3
5 4 2 4
5 4 2 5
5 4 2 6
5 4 2 7
0 0 0 0
Output:
10
10
29
29
2
2
3
4
4
Posted: Fri Feb 27, 2004 3:21 pm
by cyfra
I found my mistake .....
just a small one

I had some problems, when they could met in the last minute ....
Thanks a lot for help
Best Regads
more test cases
Posted: Tue May 11, 2004 3:06 pm
by ranjit
can somebody give me more test cases .
thanx in advance.
ranjit.
Re: more test cases
Posted: Thu Jun 24, 2004 3:45 pm
by windows2k
ranjit wrote:can somebody give me more test cases .
thanx in advance.
ranjit.
Could someone offer some idea to solve the problem?
Thx

Posted: Thu Jun 24, 2004 5:00 pm
by Observer
Simple math will do. Hint: you may start with working on the "faster" guy. Try to find out the relationship between the number of loops he travels and the number of times they meet. (That's my approach

)
Posted: Tue Nov 28, 2006 5:25 pm
by SRX
Can someone give me the correct output of the input in the following ?
thanks!
Code: Select all
50 32 35 20
100 22 13 31
24 12 41 15
467 35 231 122
36 12 24 24
0 1 2 3
Re: 10627 - Infinite Race
Posted: Thu Oct 30, 2008 6:52 am
by DJWS
Re: 10627 - Infinite Race
Posted: Sat Jul 24, 2010 10:44 am
by Blocat
From
http://uvatoolkit.com/problemssolve.php, I know this problem could be solved by gcd or other math methods. However, I didn't know how to use them for this problem. Could someone please give me more hints? Thanks.
