数论:扩展欧几里得算法
YRZ-James
who say you are not perfect?
展开
-
POJ - 1061 青蛙的约会
题目: 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观...原创 2019-04-04 21:58:30 · 416 阅读 · 0 评论 -
HDU - 1576 A/B
题目: 要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input 数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。 Output 对应每组数据输出(A/B)%9973。 Sample Input 2 100...原创 2019-04-04 23:10:56 · 69 阅读 · 0 评论 -
ZOJ - 3593 One Person Game
题目: There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point A at first and your aim is point B. There are 6 kinds of operations you can per...原创 2019-04-05 12:36:08 · 157 阅读 · 0 评论 -
POJ - 2142 The Balance
题目: Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 7...原创 2019-04-05 17:50:05 · 137 阅读 · 0 评论 -
洛谷 P1082 同余方程
题目: https://www.luogu.org/problemnew/show/P1082 代码如下: #include<bits/stdc++.h> using namespace std; typedef long long LL; void exgcd(LL &x,LL &y,int a,int b)//扩展欧几里得算法 { if(b == 0){ ...原创 2019-04-03 18:23:00 · 192 阅读 · 0 评论 -
ZOJ - 3609
题目: The modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent to ax≡1 (mod m). Input There are multiple test cases. The first line...原创 2019-04-03 19:06:54 · 248 阅读 · 0 评论