上一页 1 ··· 12 13 14 15 16
摘要: AnagramTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 15507Accepted: 6331DescriptionYou are to write a program that has to generate all possible words from a given set of letters. Example: Given the word "abc", your program should - by exploring all different combination of the t 阅读全文
posted @ 2012-07-24 15:18 myth_HG 阅读(278) 评论(0) 推荐(0) 编辑
摘要: /*ID Codes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4928 Accepted: 2964DescriptionIt is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby to counter a chronic breakdown in law and order, t 阅读全文
posted @ 2012-07-24 14:02 myth_HG 阅读(222) 评论(0) 推荐(0) 编辑
摘要: int x,y,d;void exp_gcd(int a,int b){int temp;if(b==0){x=1;y=0;d=a;//最大公约数为d}else//必须有{ exp_gcd(b,a%b); temp=x; x=y; y=temp-(a/b)*y;}} int x,y;int exp_gcd(int a,int b)//返回值为最大公约数{int temp,p;if(b==0){x=1;y=0;return a;}else//这里的else可以不要,因为return了就不会做下面。{ p=exp_gcd(b,a%b); temp=x; x=y; y=temp-(a/b)*y;re 阅读全文
posted @ 2012-07-24 11:01 myth_HG 阅读(249) 评论(0) 推荐(0) 编辑
摘要: Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input2 1000 53 87 123456789Sample Output7922 6060#include<iostream>#include<stdio.h>#incl 阅读全文
posted @ 2012-07-24 10:37 myth_HG 阅读(334) 评论(0) 推荐(0) 编辑
摘要: Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样 阅读全文
posted @ 2012-07-24 10:34 myth_HG 阅读(298) 评论(0) 推荐(0) 编辑
摘要: /*Raising Modulo NumbersTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3555Accepted: 1964DescriptionPeople are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathem 阅读全文
posted @ 2012-07-24 08:41 myth_HG 阅读(314) 评论(0) 推荐(0) 编辑
摘要: /*DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a = xy and b = xz. InputThere are several test cases. For each test case, standard inp 阅读全文
posted @ 2012-07-23 21:04 myth_HG 阅读(192) 评论(0) 推荐(0) 编辑
摘要: DescriptionTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork makes a hole in the balloon. Hydrogen is leaking out and the balloon is descending now. Soon it 阅读全文
posted @ 2012-07-23 20:08 myth_HG 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Description题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1个排列,即排列1 2 3…n。 比如:n = 3,k=2 给出排列2 3 1,则它的下1个排列为3 1 2,下2个排列为3 2 1,因此答案为3 2 1。 Input第一行是一个正整数m,表示测试数据的个数,下面是m组测试数据,每组测试数据第一行是2个正整数n( 1... 阅读全文
posted @ 2012-07-23 19:10 myth_HG 阅读(245) 评论(0) 推荐(0) 编辑
摘要: DescriptionWhile skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number was equal to the sum of the digits of the prime fact 阅读全文
posted @ 2012-07-23 14:12 myth_HG 阅读(347) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16