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 |
为什么用__int64就AC,long就RE下面是AC代码,如果long是WA还可以接受,但实在无法理解为什么long会RE, #include<iostream> using namespace std; __int64 extended_euclid(__int64 a,__int64 b,__int64 &x,__int64 &y) { __int64 ret; if(b==0) { x=1; y=0; return a; } ret=extended_euclid(b,a%b,x,y); __int64 t=x; x=y; y=t-a/b*y; return ret; } int main() { __int64 x,y,m,n,L; __int64 d,a,b,temp; scanf("%I64d %I64d %I64d %I64d %I64d",&x,&y,&m,&n,&L); d=extended_euclid(n-m,L,a,b); if((x-y)%d) printf("Impossible\n"); else { L=L/d; temp=(x-y)/d*a; temp=temp%L; while(temp<0) temp=temp+L; printf("%I64d\n",temp); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator