## 10627 - Infinite Race

Moderator: Board moderators

### 10627 - Infinite Race

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 ??

Good Luck
cyfra
Experienced poster

Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland

You may have some overflow problems. Try this input:
1 2147483647 2147483647 2147483647
Guru

Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Hi!

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 ??? )
cyfra
Experienced poster

Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland

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
Guru

Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

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

cyfra
Experienced poster

Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland

### more test cases

can somebody give me more test cases .

ranjit.
ranjit
New poster

Posts: 34
Joined: Fri Jan 30, 2004 11:22 am
Location: india

### Re: more test cases

ranjit wrote:can somebody give me more test cases .

ranjit.

Could someone offer some idea to solve the problem?
Thx
windows2k
Experienced poster

Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

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 )
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Observer
Guru

Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Can someone give me the correct output of the input in the following ?
thanks!

Code: Select all
`50 32 35 20100 22 13 31 24 12 41 15467 35 231 122 36 12 24 240 1 2 3  `
studying @ ntu csie
SRX
Learning poster

Posts: 63
Joined: Sat May 14, 2005 8:13 am
Location: Taiwan

### Re: 10627 - Infinite Race

Code: Select all
`146266112`
DJWS
Learning poster

Posts: 100
Joined: Sat Oct 11, 2003 3:30 pm
Location: Taiwan

### Re: 10627 - Infinite Race

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.
Blocat
New poster

Posts: 2
Joined: Sat Jul 24, 2010 5:25 am

### Who is online

Users browsing this forum: No registered users and 1 guest