POJ18060
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 16244 | Accepted: 5656 |
Description
For example, if you want to exchange 100 US Dollars into Russian Rubles at the exchange point, where the exchange rate is 29.75, and the commission is 0.39 you will get (100 - 0.39) * 29.75 = 2963.3975RUR.
You surely know that there are N different currencies you can deal with in our city. Let us assign unique integer number from 1 to N to each currency. Then each exchange point can be described with 6 numbers: integer A and B - numbers of currencies it exchanges, and real RAB, CAB, RBA and CBA - exchange rates and commissions when exchanging A to B and B to A respectively.
Nick has some money in currency S and wonders if he can somehow, after some exchange operations, increase his capital. Of course, he wants to have his money in currency S in the end. Help him to answer this difficult question. Nick must always have non-negative sum of money while making his operations.
Input
For each point exchange rates and commissions are real, given with at most two digits after the decimal point, 10-2<=rate<=102, 0<=commission<=102.
Let us call some sequence of the exchange operations simple if no exchange point is used more than once in this sequence. You may assume that ratio of the numeric values of the sums at the end and at the beginning of any simple sequence of the exchange operations will be less than 104.
Output
Sample Input
3 2 1 20.0
1 2 1.00 1.00 1.00 1.00
2 3 1.10 1.00 1.10 1.00
Sample Output
YES
Source
POJ18060的更多相关文章
随机推荐
- 从Excel到Python 数据分析进阶指南
目 录 第1章 生成数据表 第2章 数据表检查 第3章 数据表清洗 第4章 数据预处理 第5章 数据提取 第6章 数据筛选 第7章 数据汇总 第8章 数据统计 第9章 数据输出 案例 990万次骑 ...
- 无法启动print spooler服务,错误2,系统找不到指定的文件
来自百度: 无法启动print spooler服务,错误2,系统找不到指定的文件 我的打印机无法运行:出现"打印后台程序没有执行"提示.查:print spooler没有启动.点击 ...
- python爬虫调用谷歌翻译接口
2019年7月4日15:53:17 (¦3[▓▓] 晚安 谷歌翻译环境 Python 3.6 第三方库 Execjs (pip install PyExecJS ) 文件列表 同目录下的四个文件: - ...
- 为什么很多IT公司不喜欢进过培训机构的人呢
这几天在知乎看到一个问题“为什么很多IT公司不喜欢进过培训机构的人呢?” 身为IT培训师,这样的问题必然会引起我的关注, 花时间看了各路人士的回答, 我了个去,尽是对培训机构排山倒海的谩骂声, 负面评 ...
- 搭建CentOS 7本地源仓库
CentOS 7离线包及其依赖 推荐使用yumdownloader --resolve --destdir=path python-pip,--resolve下载所有依赖,--destdir指定软件包 ...
- mail.inc实现周密的留言发邮箱
我网站上很多地方都有给我留言的链接,这些链接指向一个地方 http://www.dushangself.site/emlog/?post=8 (源码使用方式:一共四个源代码,第一个和第二个写在一起,, ...
- EXPLAIN说明
列名 类型 解释 id SELECT语句的ID编号,优先执行编号较大的查询,如果编号相同,则从上向下执行 select_type SIMPLE 一条没有UNION或子查询部分的SELECT语句 P ...
- Visual Studio中View页面与Js页面用快捷键互相跳转
现在已经将源码放到GitHub中了 地址是 https://github.com/liningit/ViewJsLN 公司开发的项目使用的是Mvc框架,且Js与View页面是分开在两个文件夹下的,所以 ...
- Sublime Text 3 安装 BracketHighlighter
1 概述 由于最近在Sublime Text 3安装 BracketHighlighter遇到不少问题,其中踩了不少坑,因此总结下来,形成博客,希望能帮助更多的人 2 电脑环境 windows 10 ...
- jQuery 文本框 光标 移动到 文字最后
方法一:调用办法:setCaretToPos(document.getElementById("YOURINPUT"), 4); function setSelectionRang ...