上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: 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 阅读全文
posted @ 2012-12-02 20:06 Joyee 阅读(582) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-02 19:25 Joyee 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-02 17:25 Joyee 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-02 17:02 Joyee 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-01 22:19 Joyee 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 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] 阅读全文
posted @ 2012-12-01 22:13 Joyee 阅读(352) 评论(0) 推荐(0) 编辑
摘要: Description输入一个字符串,统计此字符串中字母(a-z, A-Z)、数字(0-9)、空格(' '),和其它字符的个数,输出四类字符的个数。字符串以回车来结束输入,回车不纳入统计,要求能处理空串。Input输入包含多个测试用例,第一行为一个正整数t,表示测试用例的个数,以下的t行,每行输入一个字符串(长度不超过500),每行以回车结束。Output对于每个测试用例,第一行输出Letter及其个数,第二行输出Number及其个数,第三行输出Space及其个数,第四行输出Other及其个数,使用空格分开。注意:两个测试用例之间用一个空行分开。用ASCII码的特点做,注意A~ 阅读全文
posted @ 2012-12-01 22:11 Joyee 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-12-01 22:08 Joyee 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Description向量u=(a1, a2, ...., an)和向量v=(b1, b2, ....., bn)为Rn中的两个向量,判断它们是否线性相关。Input输入包括多组测试用例,每组测试用例包括三行。第一行是一个数n(2<=n<=10),表示向量的维数。第二行是向量u的n个元素。第三行是向量v的n个元素。当输入的n为0时结束。Output对于每组测试用例输出一行。如果u和v线性相关,则输出Yes,否则输出No。这道题的测试用例似乎很糟糕,一开始写了N个漏洞多多的程序居然都给AC(包括判定一个含零向量的向量组线性无关,判定一个每项都是另一向量不同倍的向量为线性相关,某一项有 阅读全文
posted @ 2012-11-18 22:38 Joyee 阅读(470) 评论(6) 推荐(0) 编辑
摘要: Description2. 反序输出将一个正整数 n 以相反的顺序输出的递归算法的伪代码(Pseudocode )可以描述如下:If 要输出的整数只有一位Then 输出该整数Else 输出整数的个位数字反向输出除个位以外的全部数字 End请编写一个函数 void printn(int n)实现以上伪代码,注意要用递归的方法,非递归不给分,并编写主函数调用该函数测试实现是否正确。Inputn为一个简单的int的类型数据Output将用户输入的数字反向输出。一次ACvoid printn( int n ){ if ( n / 10 == 0 ) { pr... 阅读全文
posted @ 2012-11-18 22:32 Joyee 阅读(396) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页