ImageVerifierCode 换一换
格式:DOC , 页数:13 ,大小:72KB ,
资源ID:7222312      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-7222312.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(ACM第3周周赛试题.doc)为本站会员(tkhy51908)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

ACM第3周周赛试题.doc

1、A:Max Sum of Max-K-sub-sequence(3415)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)1Total Submission(s): 525 Accepted Submission(s): 51Problem DescriptionGiven a circle sequence A1,A2,A3An. Circle sequence means the left neighbour of A1 is An , and the right neighbo

2、ur of An is A1.Now your job is to calculate the max sum of a Max-K-sub-sequence. Max-K-sub-sequence means a continuous non-empty sub-sequence which length not exceed K.InputThe first line of the input contains an integer T(1= 0 & a + b + c = 9) Meaning of a, b, and c are described in the problem sta

3、tement. The last case contains exactly three 0s for all of a, b, c and indicates the end of input stream. This line should not be processed.OutputYour program should print a single integer for each input in a single line. The integer will state that how many solution there are for the given size of

4、a, b and c.Sample Input2 3 41 1 10 0 0Sample Output74Note:The valid solutions for the second sample input-output are as following:2*3 =62*4 =83*2 =64*2 =8F:Bus FairTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 978 Accepted Submission(s): 291Prob

5、lem DescriptionYou are now in Foolish Land. Once moving in Foolish Land you found that there is a strange Bus fair system. The fair of moving one kilometer by bus in that country is one coin. If you want to go to X km and your friend wants to go to Y km then you can buy a ticket of X+Y coins (you ar

6、e also allowed to buy two or more tickets for you two).Now as a programmer, you want to show your creativity in buying tickets! Suppose, your friend wants to go 1 km and you want to go 2 km. Then its enough for you to buy a 2coin ticket! Because both of you are valid passengers before crossing the f

7、irst km. and when your bus cross the first km your friend gets down from the bus. So you have the ticket of 2km! And you can safely reach to your destination, 2km using that ticket.Now, you have a large group of friends and they want to reach to different distance. You think that you are smart enoug

8、h that you can buy tickets that should manage all to reach their destination spending the minimum amount of coins. Then tell us how much we should at least pay to reach our destination.InputThere are multiple test cases. Each case start with a integer n, the total number of people in that group. 0=n

9、=1000. Then comes n integers, each of them stands for a distance one of the men of the group wants to go to. You can assume that the distance a man wants to go is always less than 10000.OutputYour program should print a single integer for a single case, the minimum amount of coins the group should s

10、pend to reach to the destination of all the members of that group.Sample Input212223Sample Output24G:Max Sum IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2014 Accepted Submission(s): 260Problem DescriptionGiven a sequence a1,a2,a3an, you can

11、cut the sequence into one or more consecutive sub-sequences as you want, for example, you can cut them into (a1.aj), (ak.al), (am.an),1jklmn. Your job is to make the maximum sum using the least number of consecutive sub-sequences. For example, given (6,-1,0, -2, 3), the max sum in this sequence is 9

12、, the number of sub-sequences is 2 not 3, they are(6), (3).InputThe first line of the input contains an integer T(1=T=20) which means the number of test cases. Then T lines follow, each line starts with a number N(1=N=1000000), then N integers followed(all the integers are between -1000 and 1000).Ou

13、tputFor each test case, you should output two lines. The first line is “Case #:“, # means the number of the test case. The second line contains two integers, the number of consecutive sub-sequences and the max sum. Output a blank line between two cases.Sample Input22 6 -55 6 -1 0 -2 3Sample OutputCa

14、se 1:1 6Case 2:2 9H:TriangleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 640 Accepted Submission(s): 241Problem DescriptionK likes to play with the balls.That day he piled a triangle (n layers, layer 1 start,the first layer has 1 ball,the secod

15、e layer has 2 balls,the nth layer has n balls), but he felt uncomfortable after completion, and want to pile a right triangle, because he felt that the number 4 is a lucky one (because of “si ji fa cai”). So he decided to use 4 times of the balls he just used as a right-edge side of the right triang

16、le(the three edges have no common factor).He only to pile the three edges,that is the middle is empty.But there will not have so many balls,so he wants to know the minimum of balls he must use.Now ,he turn to you for help.InputThe layer of the triangle as the promble describes n,1 = n 216OutputThe m

17、inimum of balls he must use and the length of the hypotenuse. One case one line Sample Input123Sample Output9 527 1353 25The second case:Let the right_edge promble describles is b ,The layer is 2,so b is 4 * (1 + 2) = 12.wo can know the edges of right triangle is 5 , 12 ,13.So the minimum of balls h

18、e must use is (5 + 12 + 13 3) = 27Subway upgradeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 69 Accepted Submission(s): 15Problem DescriptionAs we all know, one of the most important inventions for modern-day public transportation is the subway

19、, which brings much convenience to our daily-life and saves us from the congested traffic.However, to hold the next ACM regional contest, you, as the mayor of city X, decided to upgrade the subway system of that city. There are some stations and roads in the city now, any road has a cost. To save mo

20、ney, you decided not to construct every road, but to make sure that there exist a path between every two stations.Sorry, the mission isnt completed. You know, there are n stations in the city,some contestants visit other stations regularly to admire some so-called big cows. Being naturally averse to

21、 spending hours each day on commuting, you should help them to find a place to live for which the total travel time is minimal.Every road has an ID, from 1 to m. If there are multiple approaches leading to the same minimal cost, the mayor prefers the one of which road IDs selected holds the smallest

22、 lexicographic order. For instance, rebuilding ID ( 1 3 5) and ID (2 4 5) will both ensure the minimum cost,the mayor will choose the former one.InputFirst,a number t,indicating the number of the testcases.For every testcase, there is a number n and m,n(1=n=50000) indicating the number of cities,whe

23、reas m (0=m=500000) indicating the number of roads.then m lines follow each lines contains three integers a,b,c.(1=a,b=n&a!=b,1=c=10000)which means there is a road from a to b whose cost is c.OutputFirst the minimum cost.If doesnt exist,only output “Poor mayor.“(without quotes)Then output the answer

24、 and all the candidate stations.Sample Input33 31 2 102 3 203 1 153 11 2 152 11 2 15Sample Output25150Poor mayor.151 230Hint:In the first sample we use road 1 and 3 ,the minimus cost is 10+15=25and we get a new graph 3-1-2,city 1 is the best answer ,2*10+2*15=50Whereas the third, we cant get city 1,2,3 connected.In the last, we choose the road 1,the minimus cost is 15and we get a new graph 1-2,both city 1 and city 2 are the best answer ,2*15=30

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报