procedure exgcd(a,b:int64); var t:longint; begin then begin x:=;y:=; exit; end else exgcd(b,a mod b); t:=x;x:=y;y:=t-(a div b)*y; end; function cfny(a:int64):int64; var b:longint; begin b:=zs; exgcd(a,b); cfny:= ((x mod zs)+zs) mod zs; end;
模板,,, #include<cstdio> using namespace std; void exgcd(long long a,long long b,long long &x,long long &y){ if (b==0) {x=1; y=0;} else {exgcd(b,a%b,x,y); int t=y; y=x-a/b*y; x=t;} } int main(){ long long a,b,x,y; scanf("%lld %lld\n"
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1576 A/B Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4020 Accepted Submission(s): 3091 Problem Description 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%99
A. On The Way to Lucky Plaza time limit per test 1.0 s memory limit per test 256 MB input standard input output standard output Alaa is on her last day in Singapore, she wants to buy some presents to her family and friends. Alaa knows that the best p
Invoker Time Limit : 2000/1000ms (Java/Other) Memory Limit : 122768/62768K (Java/Other) Total Submission(s) : 1 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description On of Vance's favourite hero i
POJ1845:http://poj.org/problem?id=1845 思路: AB可以表示成多个质数的幂相乘的形式:AB=(a1n1)*(a2n2)* ...*(amnm) 根据算数基本定理可以得约数之和sum=(1+a1+a12+...+a1n1)*(1+a2+a22+...+a2n2)*...*(1+am+am2+...+amnm) mod 9901 对于每个(1+ai+ai2+...+aini) mod 9901=(ai(ni+1)-1)/(ai-1) mod 9901 (等比数列
题目链接: Reading comprehension Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description Read the program below carefully then answer the question.#pragma comment(linker, "/STACK:1024000000,1024000000&quo
Problem Description Farmer John keeps a website called ‘FansBlog’ .Everyday , there are many people visited this blog.One day, he find the visits has reached P , which is a prime number.He thinks it is a interesting fact.And he remembers that the vis