hdu 2669 扩展欧几里得
来源:互联网 发布:联通软件研究院 编辑:程序博客网 时间:2024/05/22 15:50
#include<cstdio>#include<iostream>#include<algorithm>typedef __int64 LL;using namespace std;LL gcd(LL a,LL b){ return b==0?a:gcd(b,a%b);}void gcd(LL a,LL b,LL& d,LL& x,LL& y){ if(!b) { d=a; x=1; y=0; } else { gcd(b,a%b,d,y,x); y-=x*(a/b); }}int main(){ LL a,b; while(~scanf("%I64d%I64d",&a,&b)) { if(gcd(a,b)!=1) { printf("sorry\n"); continue; } LL x=0,y=0; LL d=1; gcd(a,b,d,x,y); while(x<0) { x+=b; y-=a; } printf("%I64d %I64d\n",x,y); } return 0;}
- hdu 2669 扩展欧几里得
- HDU 2669 扩展欧几里得
- hdu-2669 扩展欧几里得
- HDU 2669 扩展欧几里得
- HDU 2669 Romantic 扩展欧几里得
- HDU 2669 Romantic(扩展欧几里得)
- HDU 2669 Romantic (扩展欧几里得)
- hdu 2669 Romantic 扩展欧几里得
- HDU 2669 Romantic [扩展欧几里得]
- HDU 2669 Romantic扩展欧几里得
- hdu-2669(扩展欧几里得)
- HDU 2669 Romantic (扩展欧几里得定理)
- [数论]HDU 2669 Romantic 扩展欧几里得算法
- hdu - 2669 - Romantic(扩展欧几里得)
- hdu 2669 扩展欧几里得(裸)
- HDU 2669 (扩展欧几里得入门)
- 【HDU】2669 - Romantic(扩展欧几里得)
- HDU 2669:Romantic(扩展欧几里得)
- 使用Global.asax实现ASP.Net的URL重写
- 《在线音乐网站系统》开发全程回忆
- JavaScript中 日期的计算
- 【博客已迁移到 GitHub】
- 关于gets函数和fgets函数的一些理解
- hdu 2669 扩展欧几里得
- struts2中从页面取值的三种方式
- 做网站用UTF-8还是GB2312?
- C++ reinterpret_cast,const_cast等 显式类型转换总结
- vc6.0下CppUnit安装
- Computer Graphics, Computer vision and Image processing
- 技术面试圣经《Cracking the Coding Interview》题解C++版
- 很好的博客网站
- 使用nobody运行的进程无法产生core文件的解决方法。