The 3rd Collegiate Programming Contest of Central South University
Problem A. Palindrome
Description
A palindrome is a symmetrical string, that is, a string read the same from left to right as from right to left. You are asked to write a program which, given a string, determines whether it is a palindrome or not.
Input
The first line contain a single integer T, indicates the number of test cases.
T lines follow, each line contain a string which you should judge. The length of the string is at most 1000.
Output
Print one line for each string, if it is a palindrome, output “YES”, else “NO”.
Sample Input
2 aba ab
Sample Output
YES NO
1
The 3rd Collegiate Programming Contest of Central South University
Problem B. 素数槽
Description
处于相邻的两个素数p和p + n之间的n - 1个连续的合数所组成的序列我们将其称为长度为n的素数槽。例如,?24, 25, 26, 27, 28?是处于素数23和素数29之间的一个长度为6的素数槽。
你的任务就是写一个程序来计算包含整数k的素数槽的长度。如果k本身就是素数,那么认为包含k的素数槽的长度为0。
Input
第一行是一个数字n,表示需要测试的数据的个数。后面有n行,每行是一个正整数k, k大于1并且小于或等于的第十万个素数(也就是1299709)。
Output
对于输入部分输入的每一个k,都对应输出一个非负整数,表示包含k的素数槽的长度,每个非负整数占一行。
Sample Input
5 10 11 27 2
492170
Sample Output
4 0 6 0 114
2
The 3rd Collegiate Programming Contest of Central South University
Problem C. Parsing Real Numbers
Description
In scientific notation, real numbers are written like this:
a×10b
Here we call a the coefficient and b the exponent. But the representation of real
numbers in programming language has a little different; we use the character e or E to indicate the start of the exponent. For example, 2×103 in the programming language is written as 2e3. And the exponent part of the real number is not all necessary so that the numbers as \
Real numbers may have a decimal point in the coefficient (and must have numbers on at least one side of the decimal point, e.g. \numbers, but \
The exponent of the real number is an integer and starts with the character e or E. Before the character e or E, there must have a valid coefficient.
There may be a plus or minus sign in front of the coefficient or exponent, or both (without any blank characters after the sign). e.g. \\ 3\ are not.
Note that there is no bound on the range of the numbers in the input, but for the sake of simplicity, you may assume the input strings are not longer than 1000 characters. There are no blanks in the input data.
Input
The first line of the input contains a single integer T which is the number of test cases, followed by T lines each containing the input line for a test case.
Output
The output contains T lines, each having a string which is “YES” or “NO”.
Sample Input
4
1.5e+2 3.
3
The 3rd Collegiate Programming Contest of Central South University
2.e -.35
Sample Output
YES YES NO YES
4
相关推荐: