雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年4月26日

摘要: 直接用欧几里得AX+BY=gcd(A,B);问题里s(n-m)+k*l=x-y所以存在s,k的整数解的话就要 (x-y)%gcd(n-m,l)再分情况考虑n-m是否是正负 枚举k得出解View Code #include<stdio.h>__int64 gcd(__int64 m,__int64 n){ __int64 t; while(n!=0) { t=m%n; m=n; n=t; } return m;}int main(){ __int64 x,y,m,n,l; while(scanf("%I64d%I64d%I64d%I64d%I64d",&x 阅读全文

posted @ 2011-04-26 21:50 huhuuu 阅读(211) 评论(0) 推荐(0) 编辑