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 |
本人写了一个时间复杂度为O(1)算法 试了好多数都通过 但提交不了 怎么回事呀#include <iostream.h> #include <math.h> void main() { unsigned long int x,y,m,n,L,t; cin>>x>>y>>m>>n>>L; if(m==n) cout<<"Impossible"<<endl; else { if(m>n) { if(abs(x-y)%(m-n)==0) { t=abs(x-y)/(m-n); cout<<t<<endl; } else cout<<"Impossible"<<endl; } else { if((L-abs(x-y))%(n-m)==0) { t=(L-abs(x-y))/(n-m); cout<<t<<endl; } else cout<<"Impossible"<<endl; } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator