华东师范大学计算机科学技术系
计算机科学技术系 Computer Science & Technology Department, East China Normal University 2009 年研究生机试题目 2009.4.15 Symbol Problem A Problem B Problem C Problem D Problem E Problem F Problem G Problem H Problem Sum of digit Capitalize Primes Pair GCD and LCM Sort it… Hub connection plan Separate Connections Time Limit 1000ms 1000ms 1000ms 1000ms 1000ms 1000ms 1000ms Memory Limit 65536K 65536K 65536K 65536K 65536K 65536K 65536K 65536K Principles of Compiler 1000ms
Status of Problems
All problems were newly created by the numbers of East China Normal University ACM Group. Some portions of the problem statement may be modified for correction and/or clarification.
考试说明:
上机环境:操作系统 Microsoft Windows XP 使用语言:C/C++
编译环境:TC2.0 Visual C++ 6.0 Visual C++ 7.0 (可根据自身情况选择) 可携带参考书籍和自己的书面资料, 不允许使用u盘等移动存储设备 (建议携带C语言常用库函数,常用算法的代码) 时间:2个小时
Page 1 / Total 9
华东师范大学计算机科学技术系
Problem A : 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 numbers of cases, N (1≤N≤100).N test cases follow. Each test case consists of two integers a and b which are separated by a space in a line(0≤a,b≤=100000000).
Output
For each test cases, print the number of digits of a+b.
Sample Input 3 5 7 1 99 1000 999
Sample Output 2 3 4
Page 2 / Total 9
华东师范大学计算机科学技术系
Problem B: Capitalize
Description
Write a program which replace all the lower-case letters of a given test with the corresponding capitals letters.
Input
A text including lower-case letters, periods,and space. (不超过1000个字符)
Output
Output the converted text.
Sample Input
Welcome to east china normal university.
Sample Output
WELCOME TO EAST CHINA NORMAL UNIVERSITY
Page 3 / Total 9
华东师范大学计算机科学技术系
Problem C: 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 computer 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 follow. Each test case consist of an integer N in one line.
Output
For each test case, output P
Sample Input 4 1 4 7 51
Sample Output 0 2 2 6
Page 4 / Total 9