图论补充习题.doc

图论补充习题.doc

ID:55807630

大小:45.50 KB

页数:9页

时间:2020-06-03

图论补充习题.doc_第1页
图论补充习题.doc_第2页
图论补充习题.doc_第3页
图论补充习题.doc_第4页
图论补充习题.doc_第5页
资源描述:

《图论补充习题.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、NKOJ1039:ArbitrageTimeLimit:1500ms  MemoryLimit:10000kB  TotalSubmit:56 (25users)   AcceptedSubmit:29 (24users)   PageView:1456 FontStyle:AaAaAaArbitrageistheuseofdiscrepanciesincurrencyexchangeratestotransformoneunitofacurrencyintomorethanoneunitofthesamecurrency.Forexam

2、ple,supposethat1USDollarbuys0.5Britishpound,1Britishpoundbuys10.0Frenchfrancs,and1Frenchfrancbuys0.21USdollar.Then,byconvertingcurrencies,aclevertradercanstartwith1USdollarandbuy0.5*10.0*0.21=1.05USdollars,makingaprofitof5percent.Yourjobistowriteaprogramthattakesalistofcu

3、rrencyexchangeratesasinputandthendetermineswhetherarbitrageispossibleornot.InputTheinputfilewillcontainoneormoretestcases.Omthefirstlineofeachtestcasethereisanintegern(1<=n<=30),representingthenumberofdifferentcurrencies.Thenextnlineseachcontainthenameofonecurrency.Within

4、anamenospaceswillappear.Thenextlinecontainsoneintegerm,representingthelengthofthetabletofollow.Thelastmlineseachcontainthenameciofasourcecurrency,arealnumberrijwhichrepresentstheexchangeratefromcitocjandanamecjofthedestinationcurrency.Exchangeswhichdonotappearinthetablear

5、eimpossible.Testcasesareseparatedfromeachotherbyablankline.Inputisterminatedbyavalueofzero(0)forn.OutputForeachtestcase,printonelinetellingwhetherarbitrageispossibleornotintheformat"Casecase:Yes"respectively"Casecase:No".SampleInput3USDollarBritishPoundFrenchFranc3USDolla

6、r0.5BritishPoundBritishPound10.0FrenchFrancFrenchFranc0.21USDollar3USDollarBritishPoundFrenchFranc6USDollar0.5BritishPoundUSDollar4.9FrenchFrancBritishPound10.0FrenchFrancBritishPound1.99USDollarFrenchFranc0.09BritishPoundFrenchFranc0.19USDollar0SampleOutputCase1:YesCase2

7、:NoNKOJ1784:SixDegreesofCowvinBaconTimeLimit:1500ms  MemoryLimit:65536kB  Judgetype:Multi-casesTotalSubmit:28 (15users)   AcceptedSubmit:15 (14users)   PageView:433 FontStyle:AaAaAaThecowshavebeenmakingmovieslately,sotheyarereadytoplayavariantofthefamousgame"SixDegreesofK

8、evinBacon".Thegameworkslikethis:eachcowisconsideredtobezerodegreesofseparation(degrees)awayfromh

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。