StockCharts解题报告.docVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
StockCharts解题报告

《Stock Charts》解题报告 By sx349 【问题描述】 Youre in the middle of writing your newspapers end-of-year economics summary, and youve decided that you want to show a number of charts to demonstrate how different stocks have performed over the course of the last year. Youve already decided that you want to show the price of n different stocks, all at the same k points of the year. A simple chart of one stocks price would draw lines between the points (0,price0), (1, price1), ... ,k-1, pricek-1), where pricei is the price of the stock at the ith point in time. In order to save space, you have invented the concept of an overlaid chart. An overlaid chart is the combination of one or more simple charts, and shows the prices of multiple stocks (simply drawing a line for each one). In order to avoid confusion between the stocks shown in a chart, the lines in an overlaid chart may not cross or touch. Given a list of n stocks prices at each of k time points, determine the minimum number of overlaid charts you need to show all of the stocks prices. 【输入文件】(stock.in) The first line of input will contain a single integer T, the number of test cases. After this will follow T test cases on different lines, each of the form: n k price0,0 price0,1 ... price0,k-1 price1,0 price1,1 ... price1,k-1 ... pricen-1,0 pricen-1,1 ... pricen-1,k-1 Where pricei,j is an integer, the price of the ith stock at time j. 【输出文件】(stock.out) For each test case, a single line containing Case #X: Y, where X is the number of the test-case (1-indexed) and Y is the minimum number of overlaid charts needed to show the prices of all of the stocks. 【数据范围】 1 ≤ T ≤ 100 2 ≤ k ≤ 25 0 ≤ pricei,j ≤ 1000000 1 ≤ n ≤ 100 【输入输出样例】 stock.in stock.out 3 3 4 1 2 3 4 2 3 4 6 6 5 4 3 3 3 5 5 5 4 4 6 4 5 4 5 2 1 1 2 2 5 4 4 4 4 1 Case #1: 2 Case #2: 3 Case #3: 2 【问题分析】 首先不难发现,如果两个股票价格曲线i和j要放在同一张图表当中,那么一定要满足: 因此,我们自然而然地得到了下面这个想法: 以每条曲线作为点,不断枚举两条曲线,如果这两条曲线满足上述要求(即可以放在同一张图表当中),那么就在这两条曲线当中连一条边。 显然,根据构图的方法我们可以发现,边之间没有传递性,存在无向边和不一定保证存在无向边

文档评论(0)

ctuorn0371 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档