摘要:
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 阅读全文
摘要:
/*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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样 阅读全文
摘要:
/*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 阅读全文