




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Problem A: 序列的混乱程度Time limit:1sMemory limit:128MBDescription有一个长度为n的正整数序列,一个序列的混乱程度定义为这个序列的最大值和最小值之差。请编写一个程序,计算一个序列的混乱程度。Input输入的第一行为一个正整数T(T=1000),表示一共有T组测试数据。每组测试数据的第一行为一个正整数n(1=n=1000),代表这个序列的长度。第二行为n个正整数,代表这个序列。序列中元素的大小不会超过1000。Output对于每个测试数据,输出一行包含一个正整数,代表对应序列的混乱程度。Sample Input251 2 3 4 551 9 2 4 8Sample Output48Problem B: 随机数Time limit:1sMemory limit:128MBDescription有一个rand(n)的函数,它的作用是产生一个在0,n)的随机整数。现在有另外一个函数,它的代码如下:int random(int n,int m)return rand(n)+m;显而易见的是函数random(n,m)可以产生任意范围的随机数。现在问题来了,如果我想要产生范围在a,b)内的一个随机数,那么对应的n,m分别为多少?Input输入的第一行为一个正整数T(T=1000),表示一共有T组测试数据。对于每组测试数据包含两个整数a,b(a=b)。Output对于每组测试数据,输出一行包含两个整数n和m,两个整数中间有一个空格分隔。Sample Input20 51 4Sample Output5 03 1Problem C: 完美序列Time limit:1sMemory limit:128MBDescription已知一个长度为l的序列:b1,b2,b3,bl(1=b1=b2=b3=bl=n)。若这个序列满足每个元素是它后续元素的因子,换句话说就是对于任意的i(2=i=l)都满足bi%bi-1=0(其中“%”代表求余),则称这个序列是完美的。你的任务是对于给定的n和l,计算出一共有多少序列是完美序列。由于答案很大,所有输出答案对1000000007取余后的结果。Input输入的第一行为一个正整数T(T=1000),表示一共有T组测试数据。对于每组测试数据包含两个整数n,l(1=n,l=2000),分别代表序列中元素大小的最大值和序列的长度。Output对于每组测试数据,输出一行包含一个整数,代表答案对1000000007取余后的结果。Sample Input33 26 42 1Sample Output5392Problem D: 第k大数Time limit:10sMemory limit:128MBDescription有两个序列a,b,他们的长度分别为n和m,那么将两个序列中的元素对应相乘后得到的n*m个元素从大到小排列后的第k个元素是什么?Input输入的第一行为一个正整数T(T=10),表示一共有T组测试数据。每组测试数据的第一行有三个正整数n,m和k(1=n,m=100000,1=k=n*m),分别代表a序列的长度、b序列的长度以及所求元素的下标。第二行为n个正整数代表序列a。第三行为m个正整数代表序列b。序列中所有元素的大小满足1,10000。Output对于每组测试数据,输出一行包含一个整数代表第k大的元素是多少。Sample Input33 2 31 2 31 22 2 11 11 12 2 41 11 1Sample Output311Problem E: 选房子Time limit:1sMemory limit:128MBDescription栋栋和李剑已经大四了,想要出去找房子住。他们一共看中了n套房子。其中第i套房子已经住了ai个人了,它最多能住bi个人。栋栋和李剑想要住在一起,那么请问他们有几套可以选择的房子?Input输入的第一行为一个正整数T(T=10),表示一共有T组测试数据。每组测试数据的第一行有一个正整数n(1=n=100),代表一共有n套房子。接下来n行,每行有两个正整数ai,bi(1=ai=bi=100),分别代表现在已经住了ai个人和最多能住bi个人。Output对于每组测试数据,输出一行包含一个整数,代表他们可以选择的房子的数量。Sample Input221 21 331 102 103 10Sample Output13Problem F: GameTime limit:1sMemory limit:128MBDescriptionDongDong is playing a tower defense game. In this game, we have two kinds of resource: money and wood. At the beginning of the game, DongDong possesses G money and no wood. Before the first round DongDong can use this money, and he can get money only by defeating the monsters. There is only one monster in each round, and DongDong can get money when the monster is dead. Meanwhile, DongDong can use this money in the current round. DongDong will lose the game when his hardiness is lower than the monsters attacking value, otherwise he will kill the monster. The money can increase the hardiness that one unit money can increase one unit hardiness. In addition, DongDongs initial hardiness is 0. Furthermore, the money can also increase the efficiency of lumbering. The efficiency of lumbering means the number of wood that every worker can collect at each round. The initial efficiency of lumbering is W. If DongDong trains a worker in the current round, then the worker will start working in the following rounds. DongDong will pay F money to increase one unit efficiency of lumbering or train one worker. Also, DongDong have no workers in the initial time. Only workers can lumber. Because the wood is very precious, DongDong wants to know how much wood he can get at most after N rounds?InputThe first line contains a positive integer T(T=1000), which means T test cases.The first line of each test case contains 4 positive integers N, F, W,G(1=N=1000, 1=F,W=10000, 1=G=1000000), which means N rounds, the cost of training a worker or increasing one unit efficiency of lumbering F, the initial efficiency of lumbering W, the initial money G, respectively. Then following N lines, each line contains two positive integers Ai, Gi, Ai means the attacking value of monsters, Gi means the money that Dong Dong can get after he kills the monster.OutputFor each case, if DongDong cannot finish N round game, please output “Its useless to collect wood.” (without quotes), otherwise print the most units of wood that DongDong can get.Sample Input35 1 1 11 11 11 11 11 14 10 7 1001 12 23 3100000 43 10 7 1010 1010 1020 10Sample Output13Its useless to collect wood.14Problem G: NumbersTime limit:1sMemory limit:128MBDescriptionDongDong is fond of numbers, and he has a positive integer P. Meanwhile, there is a rule that is: A positive integer D that satisfies the following rules:1. D is one of the factors of P.2. D and P have a same bit at least under the binary system.So DongDong wants to know how many positive integers D there are.InputThe first line contains a positive integer T(T=1000), which means T test cases.Then comes T lines, each line contains a positive integer P(1=p=1000000000).OutputFor each case, print the number of positive integers D that satisfies the rules.Sample Input2110Sample Output12Problem H: Counting WordsTime limit:1sMemory limit:128MBDescriptionDongDong prefers English words to English sentences, so he wants to count the words of a sentence. Could you help him?InputThe first line contains a positive integer T(T=1000), which means T test cases.Then comes T lines, each line contains a string which combines with s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 炎症性肠炎的护理常规
- 财务管理核心流程优化与控制
- 单词挑战赛课件
- 医药收货验收工作总结
- 未来教育发展蓝图
- 征信合规与信息安全培训
- 外科护理学第20章脓胸
- 住院患者低血糖的表现及护理
- 2025年商业写字楼智能化初步设计评估与智能化改造案例研究报告
- 基于流体动力学的储能电池热管理系统研究报告
- 借款合同模版
- 义务教育英语课程标准(2022年版)
- 荆州中学2024-2025高二学年下学期6月月考 英语答案
- 2018-2022北京高中合格考生物汇编:基因的表达
- 2025至2030中国IT运维管理行业发展趋势分析与未来投资战略咨询研究报告
- 新生儿病区专科理论考试题库
- 健康评估咳嗽咳痰课件
- 白酒酒店合作合同协议书
- 中国融通农业发展有限集团有限公司招聘笔试题库2025
- 实验室通风系统工程施工方案
- 2024淮安市专业技术人员继续教育试题参考答案
评论
0/150
提交评论