为什么是70分?
查看原帖
为什么是70分?
724048
GGband楼主2022/7/11 16:50
#include<bits/stdc++.h>
using namespace std;
long long a,b,x,y,m,n,l,d;
void gcd_EX(long long a,long long b,long long &x,long long &y)
{
	if(!b)
	{
		x=1;
		y=0;
		d=a;
		return;
	}
	else
	{
		gcd_EX(b,a%b,x,y);
		int tx=x;
		x=y;
		y=tx-a/b*y;
	}
	return;
}
int main()
{
	cin>>x>>y>>m>>n>>l;
	gcd_EX(n-m,l,a,b);
	if((x-y)%d!=0||m==n) cout<<"Impossible"<<endl;
	else cout<<(a*(x-y)/d%(l/d)+(l/d))%(l/d)<<endl;
	return 0;
}
2022/7/11 16:50
加载中...