# Problem C

##### Total Submission(s) : 6   Accepted Submission(s) : 5

Problem Description

Input

Output

Sample Input

2 1000 53 87 123456789

Sample Output

7922 6060

由于gcd(b,9973)=1;也就是 b和9973的公约数恒定为1。。。。

``` 1 #include<iostream>
2 using namespace std;
3 int x,y,q;
4 void exgcd(int a,int b)
5 {
6   if(b==0)
7   {
8    x=1,y=0,q=a;
9   }
10   else
11   {
12       exgcd(b,a%b);
13       int temp=x;
14       x=y,y=temp-a/b*y;
15   }
16 }
17 int main()
18 {
19     int n,b,t;
20     cin>>t;
21     while(t--)
22     {
23         cin>>n>>b;
24         exgcd(b,9973);
25         q;
26         int temp=9973/q;
27         cout<<((n/q*x%temp+temp)%temp)<<endl;
28     }
29     return 0;
30 }```

657 篇文章64 人订阅

0 条评论

## 相关文章

### hdu 3367（Pseudoforest ） (最大生成树)

Pseudoforest Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/6553...

39240

### hdu----(1677)Nested Dolls(DP/LIS（二维）)

Nested Dolls Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768...

32660

### POJ 1163 The Triangle【dp+杨辉三角加强版(递归)】

The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...

28670

### 在今天的企业环境如何使用机器学习

One of the latest trends in the world of technology and engineering is “machine ...

33550

### POJ 1015 Jury Compromise（双塔DP）

Jury Compromise Time Limit: 1000MS Memory Limit: 65536K Total Submissio...

29040

### Starship Troopers(树状dp) hdu1011

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot...

14410

### hdu----(5023)A Corrupt Mayor's Performance Art(线段树区间更新以及区间查询)

A Corrupt Mayor's Performance Art Time Limit: 2000/1000 MS (Java/Others)    Memo...

36390

### HDUOJ Children’s Queue

Children’s Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/3...

28590

### POJ-1179 Polygon （动态规划）

Polygon Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5293...

32980

### poj-----(2528)Mayor's posters(线段树区间更新及区间统计+离散化)

Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submission...

28240