hiho week 97 register

Ended

Participants:296

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-07 21:22:58

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>
#include<cmath>
using namespace std;
int n;
long m[10001],r[10001];
long gcd(long a,long b)
{
    if(a%b==0)
        return b;
    return gcd(b,a%b);
}
void extend_gcd(long a,long b,long &x,long &y)
{
    if(b==0){
        x=1;
        y=0;
        return;
    }
    extend_gcd(b,a%b,x,y);
    long tx=x;
    x=y;
    y=tx-a/b*y;
}
long solve()
{
    long M=m[0],R=r[0];
    long x,y,c,d;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX