摘要:// 表示题目意思我是理解了蛮久 英语太水了 //首先这是解密公式 m=c^d mod n// 给你 p q e 然后 n=p*q fn=(p-1)*(q-1)// 给你 e,根据公式 e*d mod fn =1 求出 d // 然后有 L个数据要解密// 算法:// 扩展欧几里得 :求 d// 快速幂运算 :解密#include #include #include #include #include #include #include using namespace std;#define maxm 100010#define maxn 1000110#define LL __int64..
阅读全文
摘要:SumdivTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10515Accepted: 2477DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natural numbers A an
阅读全文
摘要:Happy 2004Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 673Accepted Submission(s): 481Problem DescriptionConsider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest
阅读全文
摘要:Problem 1057 ab Accept: 815 Submit: 2639Time Limit: 1000 mSec Memory Limit : 32768 KBProblem Description对于任意两个正整数a,b(0<=a,b<10000)计算ab各位数字的和的各位数字的和的各位数字的和的各位数字的和。Input输入有多组数据,每组只有一行,包含两个正整数a,b。最后一组a=0,b=0表示输入结束,不需要处理。Output对于每组输入数据,输出ab各位数字的和的各位数字的和的各位数字的和的各位数字的和。Sample Input2 3 5 70 0Samp...
阅读全文
摘要:Raising Modulo NumbersTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3553Accepted: 1962DescriptionPeople 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 mathemat
阅读全文
摘要:2^x mod n = 1Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6543Accepted Submission(s): 1961Problem DescriptionGive a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.InputOne positive integer on each line, the value of n.OutputIf
阅读全文
摘要:FibonacciTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6065Accepted: 4246DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative formul
阅读全文
摘要:Pseudoprime numbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4864Accepted: 1872DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not ve
阅读全文
摘要:描述求a的b次方对c取余的值输入第一行输入一个整数n表示测试数据的组数(n<100)每组测试只有一行,其中有三个正整数a,b,c(1=<a,b,c<=1000000000)输出输出a的b次方对c取余之后的结果样例输入32 3 53 100 1011 12345 12345样例输出3110481#include <iostream>#include <cstdio>using namespace std;int main(){ long long int a,b,c,t; int T; scanf("%d",&T); whil
阅读全文