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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

本文(山东省赛ACM真题重点.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

山东省赛ACM真题重点.docx

1、山东省赛ACM真题重点Problem A Phone NumberWe know that if a phone number A is another phone number Bs prefix, B is not able to be called. For an example, A is 123 while B is 12345, after pressing 123, we call A, and not able to call B.Given N phone numbers, your task is to find whether there exits two number

2、s A and B that A is Bs prefix.InputThe input consists of several test cases.The first line of input in each test case contains one integer N (0N1001, represent the number of phone numbers.The next line contains N integers, describing the phone numbers.The last case is followed by a line containing o

3、ne zero.OutputFor each test case, if there exits a phone number that cannot be called, print “NO”, otherwise print “YES” instead.Sample Input Output for the Sample Input20120123452120123450NOYESProblem B BalloonsBoth Saya and Kudo like balloons. One day, they heard that in the central park, there wi

4、ll be thousands of people fly balloons to pattern a big image.They were very interested about this event, and also curious about the image.Since there are too many balloons, it is very hard for them to compute anything they need. Can you help them?You can assume that the image is an N*N matrix, whil

5、e each element can be either balloons or blank.Suppose element A and element B are both balloons. They are connected if:i They are adjacent;ii There is a list of element C1, C2, , Cn, while A and C1 are connected, C1 and C2 are connected Cn and B are connected.And a connected block means that every

6、pair of elements in the block is connected, while any element in the block is not connected with any element out of the block.To Saya, element A and B is adjacent if But to Kudo, element A and element B is adjacent if and They want to know that theres how many connected blocks with there own definit

7、ion of adjacent?InputThe input consists of several test cases.The first line of input in each test case contains one integer N (0N100, which represents the size of the matrix.Each of the next N lines contains a string whose length is N, represents the elements of the matrix. The string only consists

8、 of 0 and 1, while 0 represents a block and 1represents balloons.The last case is followed by a line containing one zero.OutputFor each case, print the case number (1, 2 and the connected blocks numbers with Saya and Kudos definition. Your output format should imitate the sample output. Print a blan

9、k line after each test case.Sample Input Output for the Sample Input511001001001111111010100100Case 1: 3 2Problem C ClockwiseSaya have a long necklace with N beads, and she signs the beads from 1 to N. Then she fixes them to the wall to show N-1 vectors vector i starts from bead i and end up with be

10、ad i+1.One day, Kudo comes to Sayas home, and she sees the beads on the wall. Kudo says it is not beautiful, and let Saya make it better.She says: “I think it will be better if it is clockwise rotation. It means that to any vector i (i -1, it will have the same direction with vector i +1 after clock

11、wise rotate T degrees, while 0 T 180.” It is hard for Saya to reset the beads places, so she can only remove some beads. To saving the beads, although she agrees with Kudos suggestion, she thinks counterclockwise rotation is also acceptable. A counterclockwise rotation means to any vector i (i -1, i

12、t will have the same direction with vector i +1 after counterclockwise rotate T degrees, while 0 180.” Saya starts to compute at least how many beads she should remove to make a clockwise rotation or a counterclockwise rotation.Since the necklace is very-very long, can you help her to solve this pro

13、blem?InputThe input consists of several test cases.The first line of input in each test case contains one integer N (2N300, which represents the number of beads.Each of the next N lines contains two integer x and y, represents the coordinate of the beads. You can assume that 0x, y10000.The last case

14、 is followed by a line containing one zero.OutputFor each case, print your answer with the following format:If it is clockwise rotation without removing any beads, please print “C; otherwise if it is counterclockwise rotation without removing any beads, print “CC” instead; otherwise, suppose remove

15、at least x beads to make a clockwise rotation and remove at least y beads to make a counterclockwise rotation. If xy, print “Remove x bead(s, C”, otherwise print “Remove x bead(s, CC” instead.Your output format should imitate the sample output. Print a blank line after each test case.Sample Input Ou

16、tput for the Sample Input31 12 23 33p1 12 2pspan1 1p41 12 23 32 20CCCRemove 1 bead(s, CProblem D ShoppingSaya and Kudo go shopping together.You can assume the street as a straight line, while the shops are some points on the line.They park their car at the leftmost shop, visit all the shops from lef

17、t to right, and go back to their car.Your task is to calculate the length of their route.InputThe input consists of several test cases.The first line of input in each test case contains one integer N (0N100001, represents the number of shops.The next line contains N integers, describing the situatio

18、n of the shops. You can assume that the situations of the shops are non-negative integer and smaller than 230.The last case is followed by a line containing one zero.OutputFor each test case, print the length of their shopping route.Sample Input Output for the Sample Input424 13 89 3767 30 41 14 39

19、42015270Explanation for the first sample: They park their car at shop 13; go to shop 24, 37 and 89 and finally return to shop 13. The total length is (24-13 + (37-24 + (89-37 + (89-13 = 152Problem E EmergencyKudos real name is not Kudo. Her name is Kudryavka Anatolyevna Strugatskia, and Kudo is only

20、 her nickname.Now, she is facing an emergency in her hometown:Her mother is developing a new kind of spacecraft. This plan costs enormous energy but finally failed. Whats more, because of the failed project, the government doesnt have enough resource take measure to the rising sea levels caused by g

21、lobal warming, lead to an island flooded by the sea.Dissatisfied with her mothers spacecraft and the government, civil war has broken out. The foe wants to arrest the spacecraft projects participants and the “Chief criminal” Kudos mother Doctor Ts family.At the beginning of the war, all the cities a

22、re occupied by the foe. But as time goes by, the cities recaptured one by one.To prevent from the foes arrest and boost morale, Kudo and some other people have to distract from a city to another. Although they can use some other means to transport, the most convenient way is using the inter-city roa

23、ds. Assuming the city as a node and an inter-city road as an edge, you can treat the map as a weighted directed multigraph. An inter-city road is available if both its endpoint is recaptured.Here comes the problem.Given the traffic map, and the recaptured situation, can you tell Kudo whats the short

24、est path from one city to another only passing the recaptured cities?InputThe input consists of several test cases.The first line of input in each test case contains three integers N (0N300, M (0M100000 and Q (0Q100000, which represents the number of cities, the numbers of inter-city roads and the n

25、umber of operations.Each of the next M lines contains three integer x, y and z, represents there is an inter-city road starts from x, end up with y and the length is z. You can assume that 0z10000.Each of the next Q lines contains the operations with the following format:a 0 x means city x has just

26、been recaptured.b 1 x y means asking the shortest path from x to y only passing the recaptured cities.The last case is followed by a line containing three zeros.OutputFor each case, print the case number (1, 2 first.For each operation 0, if city x is already recaptured (that is,the same 0 x operatio

27、n appears again, print “City x is already recaptured.”For each operation 1, if city x or y is not recaptured yet, print “City x or y is not available.” otherwise if Kudo can go from city x to city y only passing the recaptured cities, print the shortest paths length; otherwise print “No such path.”Y

28、our output format should imitate the sample output. Print a blank line after each test case.Sample Input Output for the Sample Input3 3 60 1 11 2 10 2 31 0 20 00 21 0 21 2 00 20 0 0Case 1:City 0 or 2 is not available.3No such path.City 2 is already recaptured.Problem F Fairy taleIt is said that in a

29、 schools underground, there is a huge treasure which can meet any desire of the owner.The Spy Union (SU is very interest in this legend. After much investigation, SU finally get the answer and let the youngest spy sneak into the school. Thats why Saya is now here.Today, Saya found the entrance event

30、ually.She enters the entrance, and found her in a fairy-tale world.“Welcome!” says a fairy, “I am Ivan. My responsibility is to protect the treasure, and give it to the one who have the ability to own it.”Then Ivan gives Saya three problems.With your help, Saya finished the first and the second prob

31、lem (Problem H and I. Here comes the third. If Saya can solve this problem, the treasure belongs to her.There is a big maze protecting the treasure. You can assume the maze as an N*N matrix while each element in the matrix might be N (North, S (South, W (West or E (East. At first, Saya is at the element (1, 1 the north-west corner, and the treasure is at (N, N the south-east corner.The designer have enchant to this matrix, so that the treasure might move from time to time respecting the following rules:Suppose the treasure is in an element which marked

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1