华师大计算机在线作业,华东师范大学计算机考研复试机试习题

华东师范大学计算机考研复试机试习题

华东师范大学计算机考研:计算机系、数据学院复试机试历年真题以及AC代码。历年学长总结得到。适用学院:计算机学院、数据学院。软件学院也可参考。sum/=10;printf("%d№n",an+);return0;大写改小写CapitalizeDescriptionWriteaprogramwhichreplaceallthelower-cas...

华东师范大学计算机考研:计算机系、数据学院复试机试历年真题以及AC代码。历年学长总结得到。适用学院:计算机学院、数据学院。软件学院也可参考。sum/=10;printf("%d№n",an+);return0;大写改小写CapitalizeDescriptionWrite a program which replace all the lower-case letters of a given text with the correspondingcaptital lettersa text including lower-case letters periods, and spaceOutputOutput The converted textSample Inputwelcome to east china normal universitySample outputWELCOME TO EAST CHINA NORMAL UNIVERSITY#include#includesstring h>char str[ 1000nt main(thile gets (st=strlen(str)nt i:for(i=0; <1; i++)if(str[i]>='a'&&str[<=z)printf(%c[0-32)elseprintf("%oc",str[);printf("\n");return 0:素数对Primes pairDescriptionWe arrange the numbers between 1 and N(1<=N<= 10000) in increasing order and decreasingorder like this123456789...NN,987654321Two numbers faced each other form a pair your task is to compute the number of pairs p suchthat both numbers in the pairs are primeThe first line of input gives the number of cases, c(1 c 100). C test cases followEach test case consists of an integer n in one lineOutputFor each test case, output PSample input4451Sample output0#includesstdio h>#includebool prime[10005;void initntprIme[0]- orme[1]=alse;//不是素数prime[2]true;/是素数for(i=3;i<=10005:+=2)prIme[i-true;/是素数prime[i+1]= false;//不是素数除0和2之外的偶数都不是素数for(i=3;i<=10005i+=2)if(prime[]=true∥/是素数」=+|whle(j=10005)prime[=fase;//不是素数int main(intint nint0//初始化while(scanf("%d", &c)!=EOF)hile(cscanf(%d", &n)int sum=0intfor(i=2i<=n/2;+)if(prime[==true&&prime[n+l-i]==true)sum++um=2;f(n%2==1/为奇数if(prime[n/2+1]==true)sum+=1printf("%d\n",sum);return o.求最大公约数和最小公倍数GCD and lCMDescriptionWrite a program which computes the greatest common divisor (gCd)and the least commonmultiple(LCm)of given a and b(0int getgcd(int a, int b)int gcd;int tlt2.gcd=t1%t2while(gcd!=Ot1=t2gcd=t1%t2return t2int main(nt n:int a. bwhile(scanf(%d",&n)=EOFhile(n-)scanf( %d%d", &a, &b:printf("%d %d\n" getgcd(a, b),a*b/(getgcd(a, b)))return0;排序后求位置处的数Sort itDescriptionThere is a database partychen want you to sort the database's data in the order from the least upto the greatest element, then do the query: Which element is i-th by its value? -with i being anatural number in a range from 1 to NIt should be able to process quickly queries like thisThe standard input of the problem consists of two parts. At first, a database is written, and thenthere's a sequence of queries. The format of database is very simple in the first line there s anumber n(1<=N<=100000), in the next n lines there are numbers of the database one in eachline in an arbitrary order a sequence of queries is written simply as well in the first line of thesequence a number of queries k(1<=k<=100)is written, and in the next k lines there arequeries one in each line. The query Which element is i-th by its value? is coded by the numberOutputThe output should consist of K lines. In each line there should be an answer to the correspondingquery. The answer to the query" is an element from the database, which is i-th by its value( inthe order from the least up to the greatest element)Sample Input1211231213Sample output1217123#include#includesalgorithm>using namespace stdint num[ 100010];int pos[ 105]:nt main(int I;chile scanf( %d", &n)!=EOF)for(i=l; i<=n; i ++scanf(%d",&num[i])scanf(%d", &k)for(ⅰ=1;i<=k;i++)scanf( %d", &posisort(num+1, num+1+n)printf("%d\n",num[pos[i]l);return o*路由器连接Hub Connection planDescriptionPartychen is working as system administrator and is planning to establish a new network in hiscompany. there will be n hubs in the company they can be connected to each other using cablesSince each worker of the company must have access to the whole network, each hub must beaccessible by cables from any other hub (with possibly some intermediate hubs)Since cables of different types are available and shorter ones are cheaper, it is necessary to makesuch a plan of hub connection that the cost is minimal. partychen will provide you all necessaryinformation about possible hub connections. You are to help partychen to find the way toconnect hubs so that all above conditions are satisfiedInputThe first line of the input contains two integer numbers N-the number of hubs in the network(2<=N<=1000)and M- the number of possible hub connections(1<=M<=15000 All hubs arenumbered from 1 to N. the following m lines contain information about possible connectionsthe numbers of two hubs which can be connected and the cable cost required to connect themcost is a positive integer number that does not exceed 106. there will always be at least one wayto connect all hubsOutputOutput the minimize cost of your hub connection planSample Input46121131142231341241nple Output#

评论0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值