分类
技术分析具备全面

外汇市场交易最主要的8种货币

Currency Exchange

Several currency exchange points are working in our city. Let ussuppose that each point specializes in two particular currenciesand performs exchange operations only with these currencies. Therecan be several points specializing in the same pair of currencies.Each point has its own exchange rates, exchange rate of A to B isthe quantity of B you get for 1A. Also each exchange point has somecommission, the sum you have to pay for your exchange operation.Commission is always collected in sourcecurrency.
For 外汇市场交易最主要的8种货币 外汇市场交易最主要的8种货币 example, if you want to exchange 100 US Dollars into RussianRubles at the exchange point, where the exchange rate is 29.75, andthe commission is 0.39 you will get (100 外汇市场交易最主要的8种货币 - 0.39) * 29.75 =2963.3975RUR.
You surely know that there are N different currencies you can dealwith in our city. Let us assign unique integer number from 1 to Nto each currency. Then each exchange point can be described with 6numbers: integer A and B - numbers of currencies it exchanges, andreal R AB, C AB,R BA andC BA - exchange rates and commissionswhen exchanging A to B and B to Arespectively.
Nick has some money in currency S and wonders if he can somehow,after some exchange operations, increase his capital. Of course, hewants to have his money in currency S in the end. Help him toanswer this difficult question. Nick must always have non-negativesum of money while making hisoperations.

The first line of the input contains four numbers: N - the numberof currencies, M - the number of exchange points, S - the number ofcurrency Nick has and V - the quantity of currency units he has.The following M lines contain 6 numbers each - the description ofthe corresponding exchange point - in specified above order.Numbers are separated by one or more spaces.1 <=S<=N<=100,1<=M<=100, V is real number,0<=V<=10 3 .
For each point exchange rates and commissions are real, given withat most two digits after the decimal point,10 -2 Let us call some sequence of the exchange operations simple if noexchange point is used more than once in this sequence. You mayassume that ratio of the numeric values of the sums at the end andat the beginning of any simple sequence of the exchange operationswill be less than 10 4 .

Simple Sidebar

The starting state of the menu will appear collapsed on smaller screens, and will 外汇市场交易最主要的8种货币 appear non-collapsed on larger screens. When toggled using the button below, the menu will change.

Make sure to keep all page content within the #page-content-wrapper . The top navbar is optional, and just for demonstration. Just create an element with the #sidebarToggle ID which will toggle the menu when clicked.