## 436 - Arbitrage (II)

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

Moderator: Board moderators

subzero
New poster
Posts: 26
Joined: Mon Aug 15, 2005 5:21 am

### Re: 436 - Arbitrage - Clarify please

hi guys,

I'm trying to solve this problem using floyd's algorithm, I have read several posts about this problem (436) but I don't get the ac...:S
here it is:

I have tried changing float to double
and the limit in the condition if ( w >1.0 ) to 1.0001, 1.000001, 1.0000001

Code: Select all

``DELETED after AC``
any idea, thanks
There is no knowledge that is no power.

fsps60312
New poster
Posts: 16
Joined: Sun Jan 25, 2015 5:46 pm

### Re: 436 - Arbitrage (II)

Though getting AC, I came up with a testcase:

Code: Select all

``````2
a
b
2
a -2 b
b -2 a
``````
My AC output gives No.
But I think the answer should be Yes.
Because:a(1)->b(-2)->a(4), then you'll have four times more than origin.
Can anyone explain?

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 436 - Arbitrage (II)

There are no negative exchange rates in the judge's input, and that doesn't make any sense.
Check input and AC output for thousands of problems on uDebug!