| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
怎样能缩短时间呢#include<iostream>
using namespace std;
int main(){
int x,y,m,n,l;
cin>>x>>y>>m>>n>>l;
if(m==n)cout<<"Impossible"<<endl;
else {
if((m%10==0)&&(n%10==0)&&(x%10==0)&&(y%10==0)&&(l%10==0)){
do{
cout<<x<<' '<<y<<' '<<l<<endl;
x=x/10;
y=y/10;
l=l/10;
m=m/10;
n=n/10;
}while((m%10==0)&&(n%10==0)&&(x%10==0)&&(y%10==0)&&(l%10==0));
}
int k=0;
do{
k++;
}while((x+k*m)%l!=(y+k*n)%l);
cout<<k<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator