12 2012 档案
摘要:DescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random letters so as to make a rectangular array of letters. For example, if the message is "There'
阅读全文
摘要:模拟赛第二题,难度应该是倒数第三……看样例输入很晕,其实看懂了还是挺简单的,因为没有跨0点的驾驶记录要设计能PASS的测试用例的话会很痛苦……=。=DescriptionLearner drivers need to complete 50 hours of supervised driving with at least 10 hours, or more, of night driving included in the total amount. Each learner must keep a log book of their supervised driving experienc
阅读全文
摘要:模拟赛最后一题,看懂了也是挺水的,难度算倒数第二了吧……DescriptionThe National Supermarket Chain (NSC) likes to boast that it has the lowest price for mortadella in the country. In fact, if a customer manages to find cheaper mortadella in any other chain, the NSC will match the price for that customer.Matej and Filip decided
阅读全文
摘要:模拟赛第一题,捡分题……DescriptionIn the olden days making decisions was easy. One would get a daisy and start to pluck its petals alternating between Do-it and Do-it-Not until the last petal was reached and a decision was made.Gadget-man wants to use a computerised version. The idea is to work with a random s
阅读全文
摘要:Description请实现一个函数,用于交换两个M * N的int类型矩阵的所有数值,其函数原型如下:void exchange(int **a, int **b, int M, int N);Hint注意:本题只需提交exchange函数的函数体,无需包含main函数以及其他部分代码,例如,只提交以下内容(仅供参考):void exchange(int **a, int **b, int M, int N){ printf("I am a student from SYSU!\n");}可以用利用多维矩阵在底层连续存储的原理,只用一层循环做(不过如果测试用例的矩阵带冗余
阅读全文
摘要:1003. tmp DescriptionImplement the following function, which copy string from b to avoid my_strcpy(char* a, char* b)InputnoneOutputnoneHint#include <string.h>#include <stdio.h>int main(){ char str_a[100] = "123456"; char str_b[100] = "123456"; my_strcpy(str_a + 1, str
阅读全文
摘要:Description你有一些小球,从左到右依次编号为1,2,3,...,n. 你可以执行两种指令(1或者2)。其中, 1 X Y表示把小球X移动到小球Y的左边, 2 X Y表示把小球X移动到小球Y右边。 指令保证合法,即X不等于Y。 例如,初始状态1,2,3,4,5,6的小球执行1 1 4后,小球...
阅读全文
摘要:DescriptionThe program must switch the text lines in a backward order and split them by the middle, processing the input lines in pairs. If an empty or blank line is found, it is considered as a line but it is not printed out to the output.InputThe input will be a text file with text lines.OutputSta
阅读全文
摘要:DescriptionN couples are standing in a circle, numbered consecutively clockwise from 1 to 2N. Husband and wife do not always stand together. We remove the couples who stand together until the circle is empty or we can't remove a couple any more. Can we remove all the couples out of the circle? I
阅读全文
摘要:DescriptionGiven a two-dimention array whose elements are all integers,please calculate the sum of its elements,ignoring thoes who sit at the edge of the array.For example,given a 7 * 4 array,you should calculate the sum of the 5 * 2 elements.InputInput contains many test cases.For each case,the fir
阅读全文
摘要:Description将输入的一串数中的负数延迟输出,从而分离非负数和负数 例如输入的数是: P1 N1 P2 N2 那么你处理完之后的输出应该是: P1 P2 N1 N2 注意: 非负数之间的输出顺序和输入顺序相同,负数之间的输出顺序和输入顺序也是要求相同的。Input输入有多个case: 每个case的输入有1行。每一行的第一个整数是N,代表这个输入有N个数需要处理,接下来有N个整数。Output对于每个case输出一行,这1行包括N个整数,整数之间以空格隔开。 输入以EOF结束 其实是从实验手册上改过来的题目,原题是奇数偶数分开输出,TA改成了非负数和负数分开输出,但是没改名字……于是名
阅读全文
摘要:Description明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。Input输入包含多个测试数据。每个测试数据有2行,第1行为1个正整数,表示所生成的随机数的个数N,第2行有N个用空格隔开的正整数,为所产生的随机数。Output对每个测试数据输出2行。第1行为1个正整数M,表示不相同的随机数的个数。第2行为M个用空格隔开的正整数,为
阅读全文
摘要:看lrj的白书刚好看到类似的题,顺手做一下Description在计算机科学上,有很多类问题是无法解决的,我们称之为不可解决问题。然而,在很多情况我们并不知道哪一类问题可以解决,那一类问题不可解决。现在我们就有这样一个问题,问题如下:1. 输入一个正整数n;2. 把n显示出来;3. 如果n=1则结束;4. 如果n是奇数则n变为3n+1 ,否则n变为n/2;5. 转入第2步。例如对于输入的正整数22,应该有如下数列被显示出来:22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1我们推测:对于任意一个正整数,经过以上算法最终会推到1。尽管这个算法很简单,但我们仍然无
阅读全文
摘要:DescriptionFakosh like playing the game "StarCraft". However, he is not so good at this game that he can't beat the AI. For victory, he typed "show me the money" to cheat, and then he would get some money in the game. Now he can build more powerful cannons and make more stron
阅读全文
摘要:DescriptionFor a positive integer N , the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N , we call N a generator of M .For example, the digit-sum of 245 is 256 (= 245 + 2 + 4 + 5). Therefore, 245 is a generator of 256.Not surprisingly, some numbers do no
阅读全文
摘要:DescriptionYou know sorting is very important. And this easy problem is:Given you an array with N non-negative integers which are smaller than 10,000,000, you have to sort this array. Sorting means that integer with smaller value presents first.InputThe first line of the input is a positive integer
阅读全文
摘要:DescriptionThere is an objective test result such as ``OOXXOXXOOO". An `O' means a correct answer of a problem and an `X' means a wrong answer. The score of each problem of this test is calculated by itself and its just previous consecutive `O's only when the answer is correct. For
阅读全文
摘要:DescriptionHave you passed the problem 1000(A - B)? Yeah,it's very easy!Now,given two integers N and M(0 < N,M <= 1050 ,N > M),calculate N + M and N * M. I think it's also very easy for you!InputThere are several test cases, one line for each case. For each line, there are only two
阅读全文
摘要:Description对于5行,5列的矩阵,问这25个整数中:1, 最大,最小的数第i行, 第j列的数2, 对这25个数进行排序,使得从左到右,从上到下非递减,(即:A[0][0] <= A[0][1] <= ... <= A[0][4] <= A[1][0] <= ...,A[4][4])正如你所见,矩阵的下标从0开始计数。Input每组数据包含5行,5列25个整数,输入有多组,EOF为结束标志Output对于每组数据,输出下列格式的信息:MAX: <i, j>MIN: <i, j>array after sorting:a[0][0]
阅读全文
摘要:Description输入一个字符串,统计此字符串中字母(a-z, A-Z)、数字(0-9)、空格(' '),和其它字符的个数,输出四类字符的个数。字符串以回车来结束输入,回车不纳入统计,要求能处理空串。Input输入包含多个测试用例,第一行为一个正整数t,表示测试用例的个数,以下的t行,每行输入一个字符串(长度不超过500),每行以回车结束。Output对于每个测试用例,第一行输出Letter及其个数,第二行输出Number及其个数,第三行输出Space及其个数,第四行输出Other及其个数,使用空格分开。注意:两个测试用例之间用一个空行分开。用ASCII码的特点做,注意A~
阅读全文
摘要:Description对输入的n个整数进行排序,按照升序输出。1 <= n <= 10000Input每个case第一行输入一个数,n(当n=0时,结束)接下来输入n个整数Output每个case输出一行,这一行是所有数字按照从小到大排序后的结果,数字与数字之间用空格隔开冒泡法:View Code 1 #include<stdio.h> 2 3 void bubbleSort( int array[], int size ); 4 void printArray( const int array[], int size ); 5 6 int main() 7 { 8 i
阅读全文

浙公网安备 33010602011771号