摘要: /*Number Sequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 27679 Accepted: 7638DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive i 阅读全文
posted @ 2012-07-24 20:20 myth_HG 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Happy 2006Time Limit: 3000MSMemory Limit: 65536KTotal Submissions: 6940Accepted: 2192DescriptionTwo positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relatively prime to 2006. Now your job is easy: for the g. 阅读全文
posted @ 2012-07-24 18:49 myth_HG 阅读(263) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;int main(){int i,a[3]={2,1,3};//sort(a,a+3);//没有这个的话,只能从当前排列。for(int j=0;j#include#include#includeusing namespace std;int main(){ int l,i;char a[15];scanf("%s",a);l=strlen(a);//sort(a,a+l,);//没有这个的话,只能从当前排列。printf("%s\n",a);//必须 阅读全文
posted @ 2012-07-24 16:28 myth_HG 阅读(586) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(283) 评论(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 阅读(245) 评论(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 阅读(251) 评论(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 阅读(299) 评论(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 阅读(316) 评论(0) 推荐(0) 编辑