hiho week 97 register

Ended

Participants:296

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-10 14:00:47

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "iostream"
#define MAX 20000000
using namespace std;
typedef long long LL;
LL m[MAX], r[MAX], n ;
LL gcd(LL a, LL b){
    if (b == 0)
        return a;
    return gcd(b, a%b);
}
void extend_gcd(LL a, LL b, LL &x, LL &y){
    if (b == 0){
        x = 1;
        y = 0;
        return ;
    }
    LL x1, y1;
    extend_gcd(b, a%b, x1, y1);
    x = y1;
    y = x1 - (a / b)*y1;
}
LL Solve()
{
    LL M = m[1], R = r[1], d, k1, k2, c;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX