HDU
来源:互联网 发布:阿里云服务器配置推荐 编辑:程序博客网 时间:2024/06/05 03:53
求逆元的写法
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#include <sstream>#define PI acos(-1.0)#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)using namespace std;typedef long long ll;const int maxn = 500 + 7, INF = 0x3f3f3f3f;const ll mod = 9973;int T;ll b, n;void exgcd(ll a, ll b, ll &d, ll &x, ll &y) { if(b == 0) { d = a; x = 1; y = 0; } else { exgcd(b, a%b, d, y, x); y -= (a/b)*x; }}int main() { scanf("%d", &T); while(T--) { scanf("%lld%lld", &n, &b); ll x, y, d; exgcd(b, mod, d, x, y); printf("%lld\n", (n*x%mod+mod)%mod ) ; } return 0;}
阅读全文
1 0
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- hdu
- hdu
- HDU
- Arrays.asList()方法的使用
- uLua 热更新 增加Manager管理类时报错问题解决
- 《OC基础教程》读书笔记6-NSString基础方法整理
- linux系统挂载与取消挂载
- Android Dagger2入门详解(六)
- HDU
- RecyclerView 添加Header
- 【leetcode】第73题 Set Matrix Zeroes 题目+解析+JAVA代码
- 算法学习笔记4-动态规划-背包问题
- linux下更改mysql密码
- jsp 输出杨辉三角
- 【总结】PHP常见面试题汇总(三)
- TensorBoard使用
- js上传实现进度圆圈以及图片预览