POJ ~ 2115 ~ C Looooops (擴展歐幾里得)

題解 設答案爲x,由題意得,同餘方程 => 。 然後求得最小的非負整數解 x 就是答案。 //#include<bits/stdc++.h> #include<iostream> #include<cstdio> using namespace std; typedef long long LL; void exgcd(LL a, LL b, LL& d, LL& x, LL& y) {
相關文章
相關標籤/搜索