10627 - Infinite Race

All about problems in Volume 106. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
cyfra
Experienced poster
Posts: 144
Joined: Thu Nov 22, 2001 2:00 am
Location: Gdynia, Poland

10627 - Infinite Race

Post 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 :wink:

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

Post by Adrian Kuegel »

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

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

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

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

Post 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

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

Post 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

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

more test cases

Post by ranjit »

can somebody give me more test cases .

thanx in advance.

ranjit.

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

Re: more test cases

Post 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 :D

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

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

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

Post 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  
studying @ ntu csie

DJWS
Learning poster
Posts: 100
Joined: Sat Oct 11, 2003 3:30 pm
Location: Taiwan
Contact:

Re: 10627 - Infinite Race

Post by DJWS »

Code: Select all

14
6
26
61
12

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

Re: 10627 - Infinite Race

Post 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. :D

Post Reply

Return to “Volume 106 (10600-10699)”