diff --git a/src/2/P1082.cpp b/src/2/P1082.cpp new file mode 100644 index 0000000..879281e --- /dev/null +++ b/src/2/P1082.cpp @@ -0,0 +1,32 @@ +/* +ax%b=1 +ax+by=1 +*/ +#include +#include + +using ll = int64_t; + +ll a,b,x,y; + +ll exgcd(ll a,ll b){ + if(b==0){ + x=1,y=0; + return a; + } + + ll d = exgcd(b,a%b); + ll tmpy = y; + y=x-a/b*y; + x=tmpy; + return d; +} + +int main(){ + std::cin>>a>>b; + exgcd(a,b); + while (x<0) { + x=(x%b+b)%b; + } + std::cout< +#include + +using ll = int64_t; + + +int main(){ + ll x,y,m,n,L; + std::cin>>x>>y>>m>>n>>L; + if(x==y){ + std::cout<<0<<'\n'; + return 0; + }else{ + if(m==n){ + std::cout<<"Impossible\n"; + return 0; + } + } + + +} \ No newline at end of file diff --git a/src/2/P2613.cpp b/src/2/P2613.cpp new file mode 100644 index 0000000..78901fe --- /dev/null +++ b/src/2/P2613.cpp @@ -0,0 +1,11 @@ +#include +#include + +using ll = int64_t; + +ll a,b; + +int main(){ + std::cin>>a>>b; + +} \ No newline at end of file diff --git a/src/2/P5656.cpp b/src/2/P5656.cpp new file mode 100644 index 0000000..11e6beb --- /dev/null +++ b/src/2/P5656.cpp @@ -0,0 +1,38 @@ +#include +#include +#include + +using ll = int64_t; + +ll T; + +ll exgcd(ll a,ll b,ll&x,ll&y){ + if(b==0){ + x=1,y=0; + return a; + } + ll d = exgcd(b,a%b,x,y); + ll tmpy = y; + y = x-(a/b)*y; + x=tmpy; + return d; +} + +int main(){ + // std::iostream::sync_with_stdio(false); + // std::cin.tie(nullptr),std::cout.tie(nullptr); + std::cin>>T; + + while(T--){ + ll a,b,c; + std::cin>>a>>b>>c; + ll x,y; + ll g{exgcd(a,b,x,y)}; + if(c%g!=0){ + std::cout<<-1<<'\n'; + continue; + } + ll f = c/g; + + } +} \ No newline at end of file