CodeForces
来源:互联网 发布:mac版的ps怎么破解 编辑:程序博客网 时间:2024/06/06 01:44
思路:主要运用扩展欧几里得公式。
#include<stdio.h>__int64 extgcd(__int64 a,__int64 b,__int64 &x,__int64 &y ){ __int64 d=a; if(b!=0) { d=extgcd(b,a%b,y,x); y-=(a/b)*x; } else { x=1; y=0; } return d;}int main(){ __int64 a,b,c,x,y; while(~scanf("%I64d %I64d %I64d",&a,&b,&c)) { __int64 k=extgcd(a,b,x,y); if(c%k!=0) { printf("-1\n"); } else printf("%I64d %I64d\n",x*(-c/k),y*(-c/k)); } return 0;}
阅读全文
0 0
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- 表达式类算法题小结
- CSS手记(三)
- DNS在架构设计中的巧用
- 第七届山东省赛 Feed the monkey(dp)
- linux下 javaweb 运行tomcat服务器 server name无法自动填充问题
- CodeForces
- 游戏策划游戏研发必读经典题文五
- typedef void fun(void)
- 序列化以及反序列化二叉树
- 海量数据处理的top K个数的问题
- 数据库索引实现底层原理2
- Andorid布局简单介绍
- win32学习04.Windows字符编码
- Mysql编码修改