




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
NKOJ 1039: ArbitrageTime Limit: 1500 ms Memory Limit: 10000 kB Total Submit : 56(25 users)Accepted Submit : 29(24 users)Page View : 1456 Font Style: Aa Aa Aa Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British pound, 1 British pound buys 10.0 French francs, and 1 French franc buys 0.21 US dollar. Then, by converting currencies, a clever trader can start with 1 US dollar and buy 0.5 * 10.0 * 0.21 = 1.05 US dollars, making a profit of 5 percent. Your job is to write a program that takes a list of currency exchange rates as input and then determines whether arbitrage is possible or not. InputThe input file will contain one or more test cases. Om the first line of each test case there is an integer n (1=n=30), representing the number of different currencies. The next n lines each contain the name of one currency. Within a name no spaces will appear. The next line contains one integer m, representing the length of the table to follow. The last m lines each contain the name ci of a source currency, a real number rij which represents the exchange rate from ci to cj and a name cj of the destination currency. Exchanges which do not appear in the table are impossible.Test cases are separated from each other by a blank line. Input is terminated by a value of zero (0) for n.OutputFor each test case, print one line telling whether arbitrage is possible or not in the format Case case: Yes respectively Case case: No.Sample Input3USDollarBritishPoundFrenchFranc3USDollar 0.5 BritishPoundBritishPound 10.0 FrenchFrancFrenchFranc 0.21 USDollar3USDollarBritishPoundFrenchFranc6USDollar 0.5 BritishPoundUSDollar 4.9 FrenchFrancBritishPound 10.0 FrenchFrancBritishPound 1.99 USDollarFrenchFranc 0.09 BritishPoundFrenchFranc 0.19 USDollar0Sample OutputCase 1: YesCase 2: NoNKOJ1784: Six Degrees of Cowvin BaconTime Limit: 1500 ms Memory Limit: 65536 kB Judge type: Multi-casesTotal Submit : 28(15 users)Accepted Submit : 15(14 users)Page View : 433 Font Style: Aa Aa Aa The cows have been making movies lately, so they are ready to play a variant of the famous game Six Degrees of Kevin Bacon. The game works like this: each cow is considered to be zero degrees of separation (degrees) away from herself. If two distinct cows have been in a movie together, each is considered to be one degree away from the other. If a two cows have never worked together but have both worked with a third cow, they are considered to be two degrees away from each other (counted as: one degree to the cow theyve worked with and one more to the other cow). This scales to the general case. The N (2 = N = 300) cows are interested in figuring out which cow has the smallest average degree of separation from all the other cows. excluding herself of course. The cows have made M (1 = M = 10000) movies and it is guaranteed that some relationship path exists between every pair of cows. Input* Line 1: Two space-separated integers: N and M * Lines 2.M+1: Each input line contains a set of two or more space-separated integers that describes the cows appearing in a single movie. The first integer is the number of cows participating in the described movie, (e.g., Mi); the subsequent Mi integers tell which cows were. Output* Line 1: A single integer that is 100 times the shortest mean degree of separation of any of the cows. Sample Input4 23 1 2 32 3 4Sample Output100NKOJ 1610: Play on WordsTime Limit: 1500 ms Memory Limit: 10000 kB Total Submit : 99(23 users)Accepted Submit : 23(17 users)Page View : 763 Font Style: Aa Aa Aa Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us. There is a large number of magnetic plates on every door. Every plate has one word written on it. The plates must be arranged into a sequence in such a way that every word begins with the same letter as the previous word ends. For example, the word acm can be followed by the word motorola. Your task is to write a computer program that will read the list of words and determine whether it is possible to arrange all of the plates in a sequence (according to the given rule) and consequently to open the door. InputThe input consists of T test cases. The number of them (T) is given on the first line of the input file. Each test case begins with a line containing a single integer number Nthat indicates the number of plates (1 = N = 100000). Then exactly Nlines follow, each containing a single word. Each word contains at least two and at most 1000 lowercase characters, that means only letters a through z will appear in the word. The same word may appear several times in the list.OutputYour program has to determine whether it is possible to arrange all the plates in a sequence such that the first letter of each word is equal to the last letter of the previous word. All the plates from the list must be used, each exactly once. The words mentioned several times must be used that number of times. If there exists such an ordering of plates, your program should print the sentence Ordering is possible. Otherwise, output the sentence The door cannot be opened. Sample Input32acmibm3acmmalformmouse2okokSample OutputThe door cannot be opened.Ordering is possible.The door cannot be opened.NKOJ其他图论基本题目1078、1755、1756、1559POJ图论基本题目1062、1125、1797、2253、1251、1258、1789、2485ACM竞赛须掌握的知识图论 路径问题 最短路径 0/1 边权最短路径 BFS 非负边权最短路径 Dijkstra u 可以用Dijkstra解决的问题的特征 负边权最短路径 Bellman-Ford u Bellman-Ford的Yen-氏优化 u 差分约束系统 Floyd u 广义路径问题 u 传递闭包 u 极小极大距离 / 极大极小距离 Euler Path / Tour 圈套圈算法 混合图的 Euler Path / Tour Hamilton Path / Tour 特殊图的Hamilton Path / Tour 构造 生成树问题 最小生成树 第k小生成树 最优比率生成树 u 0/1分数规划 度限制生成树 连通性问题 u 强大的DFS算法 无向图连通性 割点 割边 二连通分支 有向图连通性 强连通分支 u 2-SAT u 最小点基 有向无环图 拓扑排序 u 有向无环图与动态规划的关系 二分图匹配问题 u 一般图问题与二分图问题的转换思路 最大匹配 u 有向图的最小路径覆盖 u 0 / 1矩阵的最小覆盖 完备匹配 最优匹配 网络流问题 u 网络流模型的简单特征和与线性规划的关系 最大流最小割定理 最大流问题 有上下界的最大流问题 u 循环流 最小费用最大流 / 最大费用最大流 弦图的性质和判定 组合数学 u 解决组合数学问题时常用的思想 u 逼近
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电子玻璃制品钢化工应急处置分析及对策
- 家庭照护员应急处置分析及对策
- 纤维检验员实操任务书
- 飞机透明件制造胶接装配工基础技能培训手册
- 飞机管工职业技能鉴定经典试题含答案
- 农作物种植技术员应急处置分析及对策
- 制动员基础技能培训手册
- 玻纤保全保养工技能测试题库及答案
- 普通研磨机床磨工技能测试题库及答案
- 农产品食品检验员实操任务书
- 实验室生物安全管理手册
- 咨询心理学课件(共175张课件)
- Office高效办公智慧树知到期末考试答案章节答案2024年西安欧亚学院
- 全新房屋买卖合同可打印下载(2024版)
- 2024年上海铁路地产置业集团有限公司招聘笔试冲刺题(带答案解析)
- 名著西游记的阅读单与习题册(带答案)
- 区块链技术及应用
- 高中英语考试中的99个超纲词汇
- JGJ125-2016 危险房屋鉴定标准
- 电力各种材料重量表总
- 华为集团干部管理
评论
0/150
提交评论