华东师范大学计算机机试真题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
华东师范大学计算机机试真题
2009机试 (3)
计算和的数位 (3)
大写改小写 (6)
素数对 (8)
求最大公约数和最小公倍数 (12)
排序后求位置处的数 (15)
*路由器连接 (18)
*编译原理 (23)
*分开连接 (28)
2010机试 (38)
ECNU的含义 (38)
空瓶换啤酒 (41)
统计字符 (44)
2010机试热身 (47)
粽子买三送一,买五送二 (47)
工程流水线问题 (50)
2011机试 (53)
hello world (53)
Special judge (58)
查询成绩 (61)
2011机试热身 (66)
贪吃蛇 (66)
仰望星空 (74)
*编辑距离 (79)
2012机试 (84)
字母排序 (84)
幸运数 (85)
十六进制的加法 (91)
电话号码簿合并排序 (92)
*五子棋 (94)
*正则表达式匹配 (98)
2013机试 (100)
斐波那契数列的素数个数 (100)
*将a字符变成b字符最少修改次数.. 103 2013机试热身 (107)
去重排序 (107)
蛇形图案 (111)
数学手稿 (117)
2009机试
计算和的数位
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 test cases follow.
Each test case consists of two integers a and b which are separeted by a space in a line. (0<=a,b<=100000000).
Output
For each test case, print the number of digits of a + b.
Sample Input
3
5 7
1 99
1000 999
Sample Output
3
4
#include
int main()
{
int n;
int a,b;
int sum;
while(scanf("%d",&n)!=EOF) {
while(n--)
{
int an=0;
scanf("%d%d",&a,&b);
sum=a+b;
while(sum)
{
an++;
sum/=10;
}
printf("%d\n",an++);
}
return 0;
}
大写改小写
Capitalize
Description
Write a program which replace all the lower-case 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
#include
char str[1000];
int main()
{
int l;
while(gets(str))
{
l=strlen(str);
int i;
for(i=0;i { if(str[i]>='a'&&str[i]<='z') printf("%c",str[i]-32); else printf("%c",str[i]); } printf("\n"); } return 0; } 素数对 Primes Pair Description We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this: 1 2 3 4 5 6 7 8 9 . . . N N . . . 9 8 7 6 5 4 3 2 1 Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that both numbers in the pairs are prime. Input The first line of input gives the number of cases, C (1 ≤ C ≤100). C test cases