HDU 1576 A/B
来源:互联网 发布:淘宝如何打新品标 编辑:程序博客网 时间:2024/06/02 06:41
扩展欧几里得,逆推
#include <stdio.h>#include <stdlib.h>#include <string.h>#define Mod 9973using namespace std;int n,b,d;int x,y;void ex_gcd(int a, int b, int &x, int &y){ if(!b) { x = 1; y = 0; d=a; return; } ex_gcd(b, a%b, x, y); int t = x; x = y; y = t-(a/b)*y; return;}int main(){ int T; int a,b,k; scanf("%d", &T); while(T--) { scanf("%d%d", &n, &b); ex_gcd(b, Mod, x, y); x*= n/d; k = Mod/d; x = (x%k+k)%k; printf("%d\n", x%Mod); } return 0;}
阅读全文
1 0
- hdu 1576 A/B
- hdu-1576-a/b
- hdu 1576 A/B
- HDU 1576 A/B
- hdu 1576 A/B
- hdu 1576 A/B
- HDU 1576 A/B
- hdu 1576 A/B
- HDU - 1576 A/B
- hdu 1576 A/B
- hdu 1576 (A/B)
- hdu 1576 A/B
- HDU 1576:A/B
- HDU 1576 A/B
- Hdu 1576 A/B
- hdu 1576(A/B)
- HDU-1576 A/B
- HDU 1576 A/B
- Unity倒计时动画
- 187. Repeated DNA Sequences [leetcode]
- Techsoft.ASTRA.Pro.v15.0.Win32_64 1DVD(结构分析)
- java读取.properties配置文件的几种方法
- 什么是回调函数
- HDU 1576 A/B
- VMware Player安装CentOS 6.5 64位mini版
- python_闭包(Closure)
- mybatis读取数据库数据,存入Map
- HDU6103-Kirinriki
- 简单排序(冒泡 选择 插入)
- 判断给定森林中有多少棵树特别版(经典并查集)
- 微信支付(扫码支付)微信公众平台开发教程(6)
- 2466: 数字中的数字