上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: 模拟赛第一题,捡分题……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 阅读全文
posted @ 2012-12-11 21:47 Joyee 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 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");}可以用利用多维矩阵在底层连续存储的原理,只用一层循环做(不过如果测试用例的矩阵带冗余 阅读全文
posted @ 2012-12-11 21:36 Joyee 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-11 21:32 Joyee 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 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后,小球... 阅读全文
posted @ 2012-12-11 21:20 Joyee 阅读(1688) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-11 21:12 Joyee 阅读(515) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-11 21:04 Joyee 阅读(929) 评论(1) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-11 20:58 Joyee 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Description将输入的一串数中的负数延迟输出,从而分离非负数和负数 例如输入的数是: P1 N1 P2 N2 那么你处理完之后的输出应该是: P1 P2 N1 N2 注意: 非负数之间的输出顺序和输入顺序相同,负数之间的输出顺序和输入顺序也是要求相同的。Input输入有多个case: 每个case的输入有1行。每一行的第一个整数是N,代表这个输入有N个数需要处理,接下来有N个整数。Output对于每个case输出一行,这1行包括N个整数,整数之间以空格隔开。 输入以EOF结束 其实是从实验手册上改过来的题目,原题是奇数偶数分开输出,TA改成了非负数和负数分开输出,但是没改名字……于是名 阅读全文
posted @ 2012-12-11 20:54 Joyee 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Description明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。Input输入包含多个测试数据。每个测试数据有2行,第1行为1个正整数,表示所生成的随机数的个数N,第2行有N个用空格隔开的正整数,为所产生的随机数。Output对每个测试数据输出2行。第1行为1个正整数M,表示不相同的随机数的个数。第2行为M个用空格隔开的正整数,为 阅读全文
posted @ 2012-12-11 20:46 Joyee 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 看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。尽管这个算法很简单,但我们仍然无 阅读全文
posted @ 2012-12-04 12:32 Joyee 阅读(848) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页