模板题

注意exgcd函数要稍微记一下

#include<cstdio>
#include<cctype>
#include<algorithm>
#define REP(i, a, b) for(int i = (a); i < (b); i++)
#define _for(i, a, b) for(int i = (a); i <= (b); i++)
using namespace std; void read(int& x)
{
int f = 1; x = 0; char ch = getchar();
while(!isdigit(ch)) { if(ch == '-1'); f = -1; ch = getchar(); }
while(isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
x *= f;
} void exgcd(int a, int b, int& d, int& x, int& y)
{
if(!b) { d = a; x = 1; y = 0; }
else { exgcd(b, a % b, d, y, x); y -= x * (a / b); }
} int main()
{
int a, b, c, x, y, d;
read(a), read(b), read(c);
exgcd(a, b, d, x, y);
if(c % d != 0) puts("no solution!");
else printf("%d %d\b", x * (c / d), y * (c / d));
return 0;
}

最新文章

  1. C# BitArray
  2. objective-c 通过类名实例化类
  3. JavaScript DOM实战:创建和克隆元素
  4. 学习macos常用的一些快捷键笔记
  5. Android学习5&mdash;布局简介
  6. iOS 数据持久性存储-对象归档
  7. 关闭Centos的自动更新
  8. MySql中PreparedStatement对象与Statement对象
  9. vb socket的使用
  10. 《java.util.concurrent 包源码阅读》26 Fork/Join框架之Join
  11. priority queue优先队列初次使用
  12. Vue-router重修01
  13. 【WebSocket No.3】使用WebSocket协议来做服务器
  14. anaconda新建虚拟环境安装各个依赖包
  15. python - class类 (五) 继承补充-子类继承父类属性/函数方法
  16. 用户人品预测大赛--getmax队--竞赛分享
  17. [watchdog]内核失败的重启方案
  18. Phpcms V9手机门户设置教程:怎么用PC V9做手机网站
  19. 微信QQ的二维码登录原理js代码解析
  20. 转载:IE下div使用margin:0px auto不居中的原因

热门文章

  1. Model、ModelMap和ModelAndView的使用详解
  2. 03 Winform基础
  3. javaScript(其他引用类型对象)
  4. CF449D Jzzhu and Numbers (状压DP+容斥)
  5. Linux red hat 核心版下安装Nginx
  6. Vue的数据依赖实现原理简析
  7. 《一个民企CEO的职场阳谋》–读书总结(上)
  8. Docker可视化管理工具对比(DockerUI、Shipyard、Rancher、Portainer)
  9. xftp和xshell的使用
  10. CF 567C(Geometric Progression-map)