Expanding Euclid's Topics

Source: Internet
Author: User

Great God Orz (please click here for specific reference)

I made my own thoughts based on my personal feelings.

ZOJ 3609:http://acm.zju.edu.cn/onlinejudge/showproblem.do?problemid=4712 to find the minimum inverse, pit point is the 1 of the Special award

/************************************************************** Problem:User:youmi language:c++ result:a ccepted time:memory:****************************************************************///#pragma COMMENT (linker, "/stack:1024000000,1024000000")//#include <bits/stdc++.h>#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<map>#include<stack>#include<Set>#include<sstream>#include<cmath>#include<queue>#include<deque>#include<string>#include<vector>#defineZeros (a) memset (A,0,sizeof (a))#defineOnes (a) memset (A,-1,sizeof (a))#defineSC (a) scanf ("%d", &a)#defineSC2 (A, b) scanf ("%d%d", &a,&b)#defineSC3 (a,b,c) scanf ("%d%d%d", &a,&b,&c)#defineSCS (a) scanf ("%s", a)#defineSclld (a) scanf ("%i64d", &a)#definePT (a) printf ("%d\n", a)#definePtlld (a) printf ("%i64d\n", a)#defineRep0 (i,n) for (int i=0;i<n;i++)#defineREP1 (i,n) for (int i=1;i<=n;i++)#defineRep_1 (i,n) for (int i=n;i>=1;i--)#defineRep_0 (i,n) for (int i=n-1;i>=0;i--)#defineMax (a) (a) > (b)? ( A):(B))#defineMin (a) < (b) ( A):(B))#defineLson (step<<1)#defineRson (lson+1)#defineESP 1e-6#defineOO 0x3fffffff#defineTEST cout<< "*************************" <<endlusing namespaceStd;typedefLong LongLl;ll exgcd (ll a,ll b,ll&x,ll &y) {    if(b==0) {x=1, y=0; returnA; } ll ans=EXGCD (b,a%b,x,y); ll temp=x; X=y; Y=temp-a/b*y; returnans;}intMain () {Freopen ("In.txt","R", stdin); intt_t; scanf ("%d",&t_t);  for(intKase=1; kase<=t_t;kase++) {ll a,mod; scanf ("%lld%lld",&a,&MoD);        ll x, y; ll ans=EXGCD (a,mod,x,y); if(1%ans) printf ("Not exist\n"); Elseprintf ("%lld\n", (X%mod+mod)%mod+ (mod==1)); }    return 0;}

Cond.....

Expanding Euclid's Topics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.