- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
华东师范大学计算机机试真题
华东师范大学计算机机试真题
PAGE/NUMPAGES
华东师范大学计算机机试真题
TOC\o”1—2”\h\z\u
2009机试
计算和的数位
Sumofdigit
Description
Writeaprogramwhichcomputesthedigitnumberofsumoftwointegersaandb。
Input
Thefirstlineofinputgivesthenumberofcases,N(1≤N≤100).Ntestcasesfollow。
Eachtestcaseconsistsoftwointegersaandbwhichareseparetedbyaspaceinaline。(0=a,b=100000000).
Output
Foreachtestcase,printthenumberofdigitsofa+b.
SampleInput
3
57
199
1000999
SampleOutput
2
3
4
#includestdio.h
intmain()
{
intn;
inta,b;
intsum;
while(scanf(%d,&n)!=EOF)
{
while(n—-)
{
intan=0;
scanf(”%d%d,a,b);
sum=a+b;
while(sum)
{
an++;
sum/=10;
}
printf(”%d\n,an++);
}
}
return0;
}
大写改小写
Capitalize
Description
Writeaprogramwhichreplaceallthelower—caselettersofagiventextwiththecorrespondingcaptitalletters.
Input
Atextincludinglower—caseletters,periods,andspace.
Output
OutputTheconvertedtext。
SampleInput
welcometoeastchinanormaluniversity。
SampleOutput
WELCOMETOEASTCHINANORMALUNIVERSITY。
#includestdio.h
#include〈string.h
charstr[1000];
intmain()
{
intl;
while(gets(str))
{
l=strlen(str);
inti;
for(i=0;il;i++)
{
if(str[i]=’a’&str[i]=z)
printf(”%c”,str[i]—32);
else
printf(%c,str[i]);
}
printf(\n);
}
return0;
}
素数对
PrimesPair
Description
Wearrangethenumbersbetween1andN(1〈=N=10000)inincreasingorderanddecreasingorderlikethis:
123456789.。。N
N。..987654321
Twonumbersfacedeachotherformapair.YourtaskistocomputethenumberofpairsPsuchthatbothnumbersinthepairsareprime.
Input
Thefirstlineofinputgivesthenumberofcases,C(1≤C≤100).Ctestcasesfollow.
EachtestcaseconsistsofanintegerNinoneline。
Output
Foreachtestcase,outputP。
SampleInput
4
1
4
7
51
SampleOutput
0
2
2
6
#include〈stdio。h
#includestring.h
boolprime[10005];
voidinit()
{
inti;
intj;
prime[0]=prime[1]=
文档评论(0)