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

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

Re: 436 - Arbitrage - Clarify please

Post by subzero »

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

any idea, thanks
There is no knowledge that is no power.

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

Re: 436 - Arbitrage (II)

Post by fsps60312 »

Though getting AC, I came up with a testcase:

Code: Select all

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?

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

Re: 436 - Arbitrage (II)

Post by brianfry713 »

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!

Post Reply

Return to “Volume 4 (400-499)”