已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
2011年四川理工学院“达内杯”大学生程序设计竞赛试题1、Big integerProblem DescriptionCalculate the factorial of NInputInput a positive integer that less than 99.OutputThe factorial of NSample Input50Sample Output50! =304140932017133780436126081660647688443776415689605120000000000002、Look for treasuresProblem DescriptionThere are some treasures and one exit in the maze. People would consume his physical strength while he is walking, and he will resume some physical strength when he picks a treasure. Because of the limit of physical strength, John must plot his physical strength properly if he wants to walk out the maze and get all the treasures in the maze at the same time.Now, you would write a program to help John to solve the problem. Johns physical strength will decrease and if the physical strength is equal 0, he can not move.InputThe input file is named as “in.dat”, the content of this file is shown as follows:100 141 4 22 4 24 4 25 3 25 51 1 0 1 00 1 1 1 00 1 0 0 10 1 1 1 00 1 1 1 15 5The first line: the initializing physical strength of John and the consumed physical strength of each step.The second line: the total number of treasuresLine 3 to line N+2: there are 3 numbers at each line, the front two numbers is the coordinate of treasure: X,Y, the third number is the physical strength that John will get while he pick the treasure.The next line: the number of line and row (A,B, A,B=50) of the mazeThe next A lines: the map of the maze, the number 0 means it can not pass, and 1 means can pass (the position of treasures is mark with 1 at some place)The last line: the coordinate of exit (the coordinate of origin is (1,1) )OutputIf John can pick all of the treasures and walk out the maze, put out the remaining physical strength. On the other wise, put out “no, he can not”.Sample InputSample Output923、SnookerProblem DescriptionBackground: Philip likes to play the QQ game of Snooker when he wants a relax, though he was just a little vegetable-bird. Maybe you hadnt played that game yet, no matter, Ill introduce the rule for you first.There are 21 object balls on board, including 15 red balls and 6 color balls: yellow, green, brown, blue, pink, black.The player should use a white main ball to make the object balls roll into the hole, the sum of the balls fixed value he made in the hole is the players score. The player should firstly made a red ball into the hole, after that he gains red-balls value(1 points), then he gets the chance to make a color ball, then alternately. The color ball should be took out until all the red-ball are in the hole. In other word, if there are only color balls left on board, the player should hit the object balls in this order: yellow(2 point), green(3 point), brown(4 point), blue(5 point), pink(6 point), black(7 point), after the ball being hit into the hole, they are not get out of the hole, after no ball left on board, the game ends, the player who has the higher score wins the game. (PS: red object balls never get out of the hole.)I just illustrate the rules that maybe used.For example, if there are 12 red balls on board(if there are still red ball left on board, it can be sure that all the color balls must be on board either). So suppose Philp can continuesly hit the ball into the hole, he can get the maximun score is12 * 1 (12 red-ball in one shoot) + 7 * 12(after hit a red ball, a black ball which was the most valuable ball should be the target) + 2 + 3 + 4 + 5 + 6 + 7(when no red ball left, make all the color ball in hole).Now, your task is to judge whether Philip should make the decision to give up when telling you the condition on board(How many object balls still left not in the hole and the other players score). If Philp still gets the chance to win, just print Yes, otherwise print No. (PS: if the max score he could get on board add his current score is equal to the opponents current score, still output Yes)InputThe first line contains a numble N indicating the total conditions. Then followed by N lines, each line is made of three integers:Ball_Left P_Score O_Score represeting the ball number left on board, Philps current score, and the opponents current score.All the input value are in 32 bit integer value range.OutputYou should caculate the max score left Philp can gain, and judge whether he has the possiblity to win.Sample Input212 1 11 30 39Sample OutputYesNo4、Box of BricksProblem DescriptionLittle Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. “Look, Ive built a wall!”, he tells his older sister Alice. “Nah, you should make all stacks the same height. Then you would have a real wall.”, she retorts. After a little consideration, Bob sees that she is right. So he sets out to rearrange the bricks, one by one, such that all stacks are the same height afterwards. But since Bob is lazy he wants to do this with the minimum number of bricks moved. Can you help?InputThe input consists of several data sets. Each set begins with a line containing the number n of stacks Bob has built. The next line contains n numbers, the heights hi of the n stacks. You may assume 1n50 and 1hi100.The total number of bricks will be divisible by the number of stacks. Thus, it is always possible to rearrange the bricks such that all stacks have the same height.The input is terminated by a set starting with n = 0. This set should not be processed.OutputFor each set, print the minimum number of bricks that have to be moved in order to make all the stacks the same height.Output a blank line between each set.Sample Input65 2 4 1 7 50Sample Output5 5、Subset sequenceProblem DescriptionConsider the aggregate An= 1, 2, , n . For example, A1=1, A3=1,2,3. A subset sequence is defined as a array of a non-empty subset. Sort all the subset sequece of An in lexicography order. Your task is to find the m-th one. (For example,n=3,the subset sequences are A1=1, A2=1,2,A3=1,2,3,A4=1,3,A5=2,A6=2,3,A7=3,m=5,the 5th one is 2).InputThe input contains several test cases. Each test case consists of two numbers n and m ( 0 n= 20, 0 m= the total number of the subset sequence of An ). The 0 in one line is to end.OutputFor each test case, you should output the m-th subset sequence of An in one line.Sample Input1 12 12 22 30Sample Output111 226、Hotel ManagementProblem DescriptionThere are many suites in a hotel, and how to manage for more profit is a important business for the manager. Assume one suite is priced at 160-dollar a day that could makes every suite is booked by the guest. However, as the price is up with every $20, three guests would be lost. Certainly that there is a daily maintenance cost, about $40, for every used suites.InputPlease input the number of suites in this Hotel.Output Please programming for suggest a price
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年病虫害绿色防控技术推广模式考核试卷
- 注册结构工程师(一级)混凝土结构裂缝控制验算考核试卷
- 2025年福建省厦门市校园招聘中小学幼儿园中职学校教师考试笔试模拟试题及答案解析
- 2026年上海市黄浦区教育系统公开招聘360名教师(第一批)考试笔试参考题库附答案解析
- 2026年中国铁路兰州局集团有限公司招聘普通高校毕业生468人笔试考试备考试题及答案解析
- 2026河北省气象局招聘应届毕业生10人(第2602号)笔试考试参考试题及答案解析
- 2025安徽滁州定远县总医院紧密型医共体招聘工作人员43人笔试考试参考题库及答案解析
- 2025四川乐山市市中区人民医院招聘编外工作人员9人笔试考试备考题库及答案解析
- 2025北京林业大学附属实验小学招聘2人笔试考试参考题库及答案解析
- 2025广东东莞市公安局塘厦分局警务辅助人员招聘20人(第二批)笔试考试备考题库及答案解析
- 【课题研究设计与论证报告】深度学习视角下幼儿园自主游戏支持策略的实践研究
- 联通创新能力考试复习题库大全-上(单选题汇总)
- 盐酸贝尼地平片
- 金属材料凝固原理与技术PPT完整版全套教学课件
- iso9000基础知识解读课件
- 《朝花夕拾》版读书心得感想模板
- 气体充装站建设项目可行性研究报告
- GB/T 5210-2006色漆和清漆拉开法附着力试验
- 传热学-第9章辐射计算
- 安全教育登记表(三 级)
- 干挂大理石施工合同
评论
0/150
提交评论