华东师范大学计算机机试真题.doc

上传人:11****ws 文档编号:3120389 上传时间:2019-05-22 格式:DOC 页数:57 大小:206.50KB
下载 相关 举报
华东师范大学计算机机试真题.doc_第1页
第1页 / 共57页
华东师范大学计算机机试真题.doc_第2页
第2页 / 共57页
华东师范大学计算机机试真题.doc_第3页
第3页 / 共57页
华东师范大学计算机机试真题.doc_第4页
第4页 / 共57页
华东师范大学计算机机试真题.doc_第5页
第5页 / 共57页
点击查看更多>>
资源描述

1、2009 机试 .2计算和的数位 .2大写改小写 .3素数对 .4求最大公约数和最小公倍数 .6排序后求位置处的数 .7*路由器连接 .8*编译原理 .10*分开连接 .132010 机试 .17ECNU 的含义 .17空瓶换啤酒 .18统计字符 .202010 机试热身 .21粽子买三送一,买五送二 .21工程流水线问题 .222011 机试 .24hello world.24Special judge.26查询成绩 .282011 机试热身 .30贪吃蛇 .30仰望星空 .34*编辑距离 .362012 机试 .38字母排序 .38幸运数 .39十六进制的加法 .42电话号码簿合并排序 .

2、42*五子棋 .43*正则表达式匹配 .452013 机试 .46斐波那契数列的素数个数 .46*将 a 字符变成 b 字符最少修改次数 .472013 机试热身 .49去重排序 .49蛇形图案 .51数学手稿 .542009 机试计算和的数位Sum of digit Description Write a program which computes the digit number of sum of two integers a and b. Input The first line of input gives the number of cases, N(1 N 100). N te

3、st cases follow.Each test case consists of two integers a and b which are separeted by a space in a line. (0int main()int n;int a,b;int sum;while(scanf(“%d“,scanf(“%d%d“,sum=a+b;while(sum)an+;sum/=10;printf(“%dn“,an+);return 0;大写改小写Capitalize Description Write a program which replace all the lower-c

4、ase letters of a given text with the corresponding captital letters. Input A text including lower-case letters, periods, and space.Output Output The converted text. Sample Input welcome to east china normal university. Sample Output WELCOME TO EAST CHINA NORMAL UNIVERSITY. #include#includechar str10

5、00;int main()int l;while(gets(str)l=strlen(str);int i;for(i=0;i=avoid init()int i;int j;prime0=prime1=false;/不是素数prime2=true;/是素数for(i=3;iint getgcd(int a,int b)int gcd;int t1,t2;t1=a;t2=b;gcd=t1%t2;while(gcd!=0)t1=t2;t2=gcd;gcd=t1%t2;return t2;int main()int n;int a,b;while(scanf(“%d“,printf(“%d %dn

6、“,getgcd(a,b),a*b/(getgcd(a,b);return 0;排序后求位置处的数Sort it Description There is a database,partychen want you to sort the databases data in the order from the least up to the greatest element,then do the query: “Which element is i-th by its value?“- with i being a natural number in a range from 1 to N

7、.It should be able to process quickly queries like this. Input The standard input of the problem consists of two parts. At first, a database is written, and then theres a sequence of queries. The format of database is very simple: in the first line theres a number N (1#includeusing namespace std;int

8、 num100010;int pos105;int main()int n;int i;int k;while(scanf(“%d“,i#includeusing namespace std;struct Edgeint a,b;int cost;E15010;int Tree1010;int findRoot(int x)if(Treex=-1)return x;elseint tmp=findRoot(Treex);Treex=tmp;return tmp;bool Cmp(Edge a,Edge b)return a.costb.cost;int main()int n;int m;int i;while(scanf(“%d“,for(i=1;i=m;i+)scanf(“%d%d%d“,sort(E+1,E+1+m,Cmp);/排序for(i=1;i=n;i+)Treei=-1;int ans=0;for(i=1;i=m;i+)int a=findRoot(Ei.a);int b=findRoot(Ei.b);if(a!=b)Treea=b;ans+=Ei.cost;printf(“%dn“,ans);return 0;*编译原理Principles of Compiler

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 精品笔记

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。