第一范文网 - 专业文章范例文档资料分享平台

中南大学第三届ACM校赛题目

来源:用户分享 时间:2025/6/9 23:12:34 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

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

搜索更多关于: 中南大学第三届ACM校赛题目 的文档
中南大学第三届ACM校赛题目.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0wq1t8j61d9da6a52iwk_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top