科技文化程序大赛.docVIP

  • 4
  • 0
  • 约6.88千字
  • 约 12页
  • 2017-03-30 发布于江苏
  • 举报
科技文化程序大赛

基础: 回文数 Time Limit: 1000MS    Memory Limit: 16,000K Description 我国古代有一种回文诗,倒念顺念都一样,例如经典的对联“客上天然居,居然天上客”。此种例子举不胜举。在自然数中也有类似情形,比如1991就是一个很特殊的四位数,从左向右读与从右向左读竟是完全一样的,这样的数称为“回文数”。编程序输出1到10000内的所有回文数并统计个数。 Input 无 Output 输出1到10000内的所有回文数并统计个数。每个数占一行。 A:极值问题 Time Limit: 1000MS    Memory Limit: 16,000K Description 已知m,n为整数,且满足下列两个条件: m,n∈1,2,3,…,k(1≤k≤109); ② (n2-mn-m2)2=1; 输入m和n的上限k,求一组满足上述两个条件且使m2+n2的值最大的m和n。 Input 测试数据的第一行为测试用例数,每个测试用例仅一个整数,即包含m和n的上限k,且1≤k≤109。 Output 对每个测试用例,输出仅一行,输出满足上述两个条件的且使m2+n2的值最大的m和n。 Sample Input 2 3 10 Sample Output 2 3 5 8 B:大写字母排序 Time Limit: 1000MS    Memory Limit: 16,000K Description 编写一个程序,当输入不超过60个字符组成的英文文字时,计算机将这个句子中的大写字母按英文字典字母顺序重新排列,排列后的单词的长度要与原始句子中的长度相同。例如: 大写字母排序前: THE PRICE OFBREAD IS $1.25 PER POUND. 排序后: ABC DDEEE EFHI INO OP $1.25 PPR RRSTU. 要求只对大写字母A到Z的字母重新排列,其它字符保持原来的状态。 Input 测试数据的第一行为测试用例数,每个测试用例占一行,长度不超过60个字符。 Output 对每个测试用例,输出仅一行,输出排序后的字符。 Sample Input 2 THE PRICE OFBREAD IS $1.25 PER POUND. This IS A TeST! Sample Output ABC DDEEE EFHI INO OP $1.25 PPR RRSTU. Ahis IS S TeTT! C:A famous math puzzle Time Limit: 1.0 Seconds Memory Limit: 65536K Description Maybe you knew this famous puzzle when you were a child. You have two jugs, A and B, and an infinite supply of water. There are three types of actions that you can use: (1) you can fill a jug, (2) you can empty a jug, and (3) you can pour from one jug to the other. Pouring from one jug to the other stops when the first jug is empty or the second jug is full, whichever comes first. For example, if A has 5 gallons and B has 6 gallons and a capacity of 8, then pouring from A to B leaves B full and 3 gallons in A. As to a given cubage W, a solution is a sequence of steps that leaves exactly W gallons in one of the jugs. For example, when A=5, B=6 and W=4, we can take the following steps to achieve the goal. A B initial 0 0 fill A 5 0 pour A B 0 5 fill A 5 5 pour A B 4 6 empty B 4 0 Today, we will generalize the puzzle. You are given N jugs, and asked to decide

文档评论(0)

1亿VIP精品文档

相关文档