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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

杭电部分题目.docx

1、杭电部分题目杭电1015SafecrackerTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4768Accepted Submission(s): 2386Problem Description= Op tech briefing, 2002/11/02 06:42 CST =The item is locked in a Klein safe behind a painting in the second-floor library. Kl

2、ein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in World War II. Fortunately old Brumbaugh from research knew Kleins secrets and wrote them down before he died. A Klein safe has two distinguishing features: a combination lock that uses letters instead of

3、numbers, and an engraved quotation on the door. A Klein quotation always contains between five and twelve distinct uppercase letters, usually at the beginning of sentences, and mentions one or more numbers. Five of the uppercase letters form the combination that opens the safe. By combining the digi

4、ts from all the numbers in the appropriate way you get a numeric target. (The details of constructing the target number are classified.) To find the combination you must select five letters v, w, x, y, and z that satisfy the following equation, where each letter is replaced by its ordinal position i

5、n the alphabet (A=1, B=2, ., Z=26). The combination is then vwxyz. If there is more than one solution then the combination is the one that is lexicographically greatest, i.e., the one that would appear last in a dictionary.v - w2 + x3 - y4 + z5 = targetFor example, given target 1 and letter set ABCD

6、EFGHIJKL, one possible solution is FIECB, since 6 - 92 + 53 - 34 + 25 = 1. There are actually several solutions in this case, and the combination turns out to be LKEBA. Klein thought it was safe to encode the combination within the engraving, because it could take months of effort to try all the pos

7、sibilities even if you knew the secret. But of course computers didnt exist then.= Op tech directive, computer division, 2002/11/02 12:30 CST =Develop a program to find Klein combinations in preparation for field deployment. Use standard test methodology as per departmental regulations. Input consis

8、ts of one or more lines containing a positive integer target less than twelve million, a space, then at least five and at most twelve distinct uppercase letters. The last line will contain a target of zero and the letters END; this signals the end of the input. For each line output the Klein combina

9、tion, break ties with lexicographic order, or no solution if there is no correct combination. Use the exact format shown below.Sample Input1 ABCDEFGHIJKL11700519 ZAYEXIWOVU3072997 SOUGHT1234567 THEQUICKFROG0 ENDSample OutputLKEBAYOXUZGHOSTno solution#include#include#includelong get_taget(int i,int j

10、,int k,int l,int m)long taget=0;taget=i-pow(float)j,2)+pow(float)k,3)-pow(float)l,4)+pow(float)m,5);return taget;void sort(int array, int size) int i, j, temp; for(i=0; isize-1; i+) for(j=0; jsize-1; j+) if(arrayj arrayj+1) temp = arrayj; arrayj = arrayj+1; arrayj+1 = temp; int main()int i,j,k,l,m,l

11、en,f;long data,taget;char str12;int key12=0;while(scanf(%ld%s,&data,&str)f=0;if(0=data&E=str0&N=str1&D=str2) break;len=strlen(str);if(len12)break;for(i=0;ilen;+i)keyi=stri-A+1;sort(key,len);for(i=0;ilen;+i)for(j=0;jlen;+j)if(i=j)continue;for(k=0;klen;k+)if(k=i|k=j)continue;for(l=0;llen;l+)if(l=k|l=i

12、|l=j)continue;for(m=0;mlen;m+)if(m=l|m=k|m=j|l=i)continue;taget=get_taget(keyi,keyj,keyk,keyl,keym);if(taget=data)f=1;keyi=keyi+64;keyj=keyj+64;keyk=keyk+64;keyl=keyl+64;keym=keym+64;printf(%c%c%c%c%cn,keyi,keyj,keyk,keyl,keym);if(f=0)printf(no solutionn);return 0;杭电1017:A Mathematical CuriosityTime

13、 Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16821Accepted Submission(s): 5238Problem DescriptionGiven two integers n and m, count the number of pairs of integers (a,b) such that 0 a b n and (a2+b2 +m)/(ab) is an integer.This problem contains multip

14、le test cases!The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.The output format consists of N output blocks. There is a blank line betw

15、een output blocks.InputYou will be given a number of cases in the input. Each case is specified by a line containing the integers n and m. The end of input is indicated by a case in which n = m = 0. You may assume that 0 n = 100.OutputFor each case, print the case number as well as the number of pai

16、rs (a,b) satisfying the given property. Print the output for each case on one line in the format as shown below.Sample Input110 120 330 40 0Sample OutputCase 1: 2Case 2: 4Case 3: 5#includevoid main() int N; while(scanf(%d,&N)!=EOF) int key; for(key=0;keyN;key+) int n,m,x=0; while(scanf(%d %d,&n,&m)!

17、=EOF) int i,j,count=0; if(n=0&m=0) break; for(i=1;in;i+) for(j=i+1;jn;j+) if(i*i+j*j+m)%(i*j)=0) count+; printf(Case %d: %dn,+x,count); if(key!=N-1) printf(n); 杭电1019Least Common MultipleTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17599Accepted

18、 Submission(s): 6554Problem DescriptionThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.InputInput will consist of multiple problem instances. The first line of

19、the input will contain a single integer indicating the number of problem instances. Each instance will consist of a single line of the form m n1 n2 n3 . nm where m is the number of integers in the set and n1 . nm are the integers. All integers will be positive and lie within the range of a 32-bit in

20、teger.OutputFor each problem instance, output a single line containing the corresponding LCM. All results will lie in the range of a 32-bit integer.Sample Input23 5 7 156 4 10296 936 1287 792 1Sample Output10510296SourceEast Central North America 2003, Practice#include int LCM(int m,int n) int lcm,s

21、,r,t,mm,nn; mm=m; nn=n; if(mn) t=m; m=n; n=t; while(n!=0) r=m%n; m=n; n=r; lcm=mm/m*nn; return lcm;int main() int t; int num1000; int i,n; while(scanf(%d,&t)!=EOF) while(t-) scanf(%d,&n); for(i=0;in;i+) scanf(%d,&numi); for(i=0;in-1;i+) numi+1=LCM(numi,numi+1); printf(%dn,numi); return 0; 杭电1020Enco

22、dingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17004Accepted Submission(s): 7270Problem DescriptionGiven a string containing only A - Z, we could encode it using the following method:1. Each sub-string containing k same characters should be en

23、coded to kX where X is the only character in this sub-string.2. If the length of the sub-string is 1, 1 should be ignored.InputThe first line contains an integer N (1 = N = 100) which indicates the number of test cases. The next N lines contain N strings. Each string consists of only A - Z and the l

24、ength is less than 10000.OutputFor each test case, output the encoded string in a line.Sample Input2ABCABBCCCSample OutputABCA2B3C#includevoid main() int n; char a10000; while(scanf(%d,&n)!=EOF) int i; getchar(); while(n-) gets(a); for(i=0;ai!=0;i+) int temp=1; while(ai=ai+1) temp+; i+; if(temp=1) p

25、rintf(%c,ai); else printf(%d%c,temp,ai); printf(n); 杭电1166敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20003Accepted Submission(s): 8757Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视

26、这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问:“Tidy,马上汇报第3个营地到第10个营地共有多少人!”Tidy就要马上开始计算这一段的总人数并汇报。但敌兵营地的人数经常变动,而Derek每次询问的段都不一样,所以Tidy不得不每次都一个一个营地的去数,很快就精疲力尽了,Derek对Tidy的计算速度越来越不满:你个死肥仔,算得这么慢,

27、我炒你鱿鱼!”Tidy想:“你自己来算算看,这可真是一项累人的工作!我恨不得你炒我鱿鱼呢!”无奈之下,Tidy只好打电话向计算机专家Windbreaker求救,Windbreaker说:“死肥仔,叫你平时做多点acm题和看多点算法书,现在尝到苦果了吧!”Tidy说:我知错了。但Windbreaker已经挂掉电话了。Tidy很苦恼,这么算他真的会崩溃的,聪明的读者,你能写个程序帮他完成这项工作吗?不过如果你的程序效率不够高的话,Tidy还是会受到Derek的责骂的.Input第一行一个整数T,表示有T组数据。每组数据第一行一个正整数N(N=50000),表示敌人有N个工兵营地,接下来有N个正整数

28、,第i个正整数ai代表第i个工兵营地里开始时有ai个人(1=ai=50)。接下来每行有一条命令,命令有4种形式:(1) Add i j,i和j为正整数,表示第i个营地增加j个人(j不超过30)(2)Sub i j ,i和j为正整数,表示第i个营地减少j个人(j不超过30);(3)Query i j ,i和j为正整数,i=j,表示询问第i到第j个营地的总人数;(4)End 表示结束,这条命令在每组数据最后出现;每组数据最多有40000条命令Output对第i组数据,首先输出“Case i:”和回车,对于每个Query询问,输出一个整数并回车,表示询问的段中的总人数,这个数保持在int以内。Sample Input1101 2 3 4 5 6 7 8 9 10Query 1 3Add 3 6Query 2 7Sub 10 2Add 6 3Query 3 10End Sample OutputCase 1:63359(线段树)#include#include#define MAX 50010int numMAX;typedef struct node int lchild; int rchild; int number;node a4*MAX;int bulit(int s,int t,int step) int k,mid,x,y; if(s=t) astep.

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

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