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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

ACM练习.docx

1、ACM练习子序列时间限制:2000ms | 内存限制:65535KB描述给定两个字符串序列A,B,求A序列不同位置构成的子序列中和B序列相同的有多少个。例如A序列为a1b2c3d4c5(序列为abcdc,12345是为区分位置而加入的数字),B序列abc这A序列不同位置构成的子序列中和B相同的有a1b2c3,a1b2c5两个输入第一行一个数N(N不大于5)表示有N组测试数据以下每组测试数据有两行 分别是字符串A和B,其中A串的长度不大于100000,B串的长度不多于1000,并且B长度多于100的只有一组数据输出对应每组数据输出一个整数,由于数字可能会很大,请对10003取余后再输出样例输入3

2、aaaabcbcabcabcdefabcdefdefaa样例输出033项链时间限制:1000ms | 内存限制:65535KB描述在Mars星球上,每个Mars人都随身佩带着一串能量项链。在项链上有N颗能量珠。能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数。并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记。因为只有这样,通过吸盘(吸盘是Mars人吸收能量的一种器官)的作用,这两颗珠子才能聚合成一颗珠子,同时释放出可以被吸盘吸收的能量。如果前一颗能量珠的头标记为m,尾标记为r,后一颗能量珠的头标记为r,尾标记为n,则聚合后释放的能量为(Mars单位),新产生的

3、珠子的头标记为m,尾标记为n。需要时,Mars人就用吸盘夹住相邻的两颗珠子,通过聚合得到能量,直到项链上只剩下一颗珠子为止。显然,不同的聚合顺序得到的总能量是不同的,请你设计一个聚合顺序,使一串项链释放出的总能量最大。例如:设N=4,4颗珠子的头标记与尾标记依次为(2,3)(3,5)(5,10)(10,2)。我们用记号表示两颗珠子的聚合操作,(jk)表示第j,k两颗珠子聚合后所释放的能量。则第4、1两颗珠子聚合后释放的能量为:(41)=10*2*3=60。这一串项链可以得到最优值的一个聚合顺序所释放的总能量为(41)2)3)=10*2*3+10*3*5+10*5*10=710。输入有多组测试数

4、据(15),每组数据有两行。每组数据的第一行是一个正整数N(4N100),表示项链上珠子的个数。第二行是N个用空格隔开的正整数,所有的数均不超过1000。第i个数为第i颗珠子的头标记(1iN),当iN时,第i颗珠子的尾标记应该等于第i+1颗珠子的头标记。第N颗珠子的尾标记应该等于第1颗珠子的头标记。至于珠子的顺序,你可以这样确定:将项链放到桌面上,不要出现交叉,随意指定第一颗珠子,然后按顺时针方向确定其他珠子的顺序。输出对应每组数据,输出只有一行,是一个正整数E(E2.1*109),为一个最优聚合顺序所释放的总能量样例输入42 3 5 10样例输出710连连看时间限制:1000ms | 内存限

5、制:65535KB描述 最近zmh迷上了有趣的游戏-连连看,很多人都会玩吧!游戏是这样的,在一个m*n的矩阵中,每个格子里面放一种物品,如果两个格子里的物品相同,并且这两个格子连接的路径符合要求,就可以清空这两个格子。连接两个格子的路径最多只能转折两次,能清空的情况如下图所示:(每个物品都有编号,如果两个格子里物品的编号相同,就表示是同一类物品,编号为0就表示格子里没有物品)。截个屏看一下现在游戏开始,zmh每次选择一对方格,可以消除两个物品的话得1分,当zmh选择他t对格子后,他想知道自己得了多少分,你能告诉他吗?输入本题有多组测试数据,不超过15组。每一组第一行三个整数m,n,t(m=10

6、0,n=10000,t=100).下面有m行,每行含n个整数x(0x100000),x为坐标为(m,n)的方格里物品的编号。接下来的t行,每行包含四个整数,分别表示选择两个格子的坐标。Hint:n超过100的数据不超过两组。输出每组数据输出占一行,输出每局游戏zmh的得分。样例输入3 3 21 1 22 0 11 0 21 1 1 21 3 2 14 3 11 0 22 0 11 0 32 2 21 1 2 3样例输出21字串和之差时间限制:3000ms | 内存限制:65535KB描述给出一个数列a1,a2,a3,a4an,选出一个连续非空子序列,使该序列的绝对值max最大,再选出一个非空子

7、序列(与第一个序列的选择无关),使该序列的绝对值min最小。输出max与min的差值。输入第一行是一个整数m(m15)表示测试数据的组数。每组数据第一行是一个整数 n(n1000000),表示这个数列元素的个数,接下来一行是n个整数x(-100x100)。输出输出max与min的差值(max-min).每组数据输出占一行。样例输入24-1 1 3 252 3 -2 4 1样例输出67寻找最大数时间限制:1000ms | 内存限制:65535KB描述请在整数 n 中删除m个数字, 使得余下的数字按原次序组成的新数最大,比如当n=92081346718538,m=10时,则新的最大数是9888输入

8、第一行输入一个正整数T,表示有T组测试数据每组测试数据占一行,每行有两个数n,m(n可能是一个很大的整数,但其位数不超过100位,并且保证数据首位非0,m小于整数n的位数)输出每组测试数据的输出占一行,输出剩余的数字按原次序组成的最大新数样例输入292081346718538 101008908 5样例输出988898Light Bulb时间限制:1000ms | 内存限制:65535KB描述 Compared to wildleopards wealthiness, his brother mildleopard is rather poor. His house is narrow and

9、 he has only one light bulb in his house. Every night, he is wandering in his incommodious house, thinking of how to earn more money. One day, he found that the length of his shadow was changing from time to time while walking between the light bulb and the wall of his house. A sudden thought ran th

10、rough his mind and he wanted to know the maximum length of his shadow.输入The first line of the input contains an integer T (T = 10(-3).输出For each test case, output the maximum length of mildleopards shadow in one line, accurate up to three decimal places.样例输入22 1 0.52 0.5 3样例输出1.0000.750Invade the Ma

11、rs时间限制:20000ms | 内存限制:65535KB描述Its now the year 21XX,when the earth will explode soon.The evil U.S. decided to invade the Mars to save their lives.But the childlike Marsmen never keeps any army,because war never take place on the Mars.So its very convenient for the U.S. to act the action.Luckily,the

12、 Marsmen find out the evil plan before the invadation,so they formed a defense system.The system provides enchantment for some citys,and the enchantment generator for city A maybe set in city B,and to make things worse,both city B and C and more will provide echantment for city A.The satelite of U.S

13、. has got the map of the Mars.And they knows that when they enter a city,they can destory all echantment generator in this city at once,and they can enter a city only if they has destoryed all enchantment generator for this city,but troops can stay at the outside of the city and can enter it at the

14、moment its echantment is destoryed.Of course the U.S. army will face no resistance because the Mars keep no army,so troops can invade in many way at the same time.Now the U.S. will invade the Mars,give you the map,your task is to calculate the minimium time to enter the capital of the Mars.下面是输入样例的提

15、示输入The first line contains an integer T,which is the number of test cases.For each testcase:The first line contains two integers N and M,1=N=3000,1=M=70000,the cities is numbered from 1 to N and the U.S. landed on city 1 while the capital of the Mars is city N.The next M lines describes M paths on t

16、he Mars.Each line contains three integers ai,bi and wi,indicates there is a unidirectional path form ai to bi lasts wi minutes(1=wi=108).The next N lines describes N citys,the 1+M+i line starts with a integer li,followed with li integers, which is the number of cities has a echantment generator prot

17、ects city i.Its guaranteed that the city N will be always reachable.输出For each case,print a line with a number indicating the minimium time needed to enter the capital of the Mars.样例输入16 61 2 11 4 32 3 12 5 24 6 25 3 20001 302 3 5样例输出5ShippingCubes时间限制:2000ms | 内存限制:65535KB描述You want to ship N cubes

18、 abroad. The size of each cube is 1 x 1 x 1. You can only ship the cubes by filling them into a single cuboid box. The cost of shipping a cuboid box with dimensions a x b x c is equal to (a+b+c).You cant leave any empty space in the box, because the cubes would shift and get damaged during the trans

19、fer.You are given an int N. Return the minimal cost of shipping N cubes.提示:1Returns: 3The only way is to use a box with dimensions 1 x 1 x 1.6Returns: 6This time one optimal solution is to send a box with dimensions 1 x 2 x 3. The cost of sending this box is 1+2+3 = 6. Any other option is at least as expensive as this one. For example, sending a box with dimensions 6 x 1 x 1 has the cost 6+1+1 = 8.输入: Some cases (case 40);Each line have a numeral N (N will be between 1 and 200, inclusive.)输出: For each N,Return the minimal cost of shipping N cubes样例输入167200样例输出36918

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

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