hiho week 70 register

Ended

Participants:371

Verdict:Accepted
Score:100 / 100
Submitted:2015-11-02 17:07:01

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>
using namespace std;
int f[105][105][55];
int gcd[5010];
int gd(int x,int y)
{
    int t;
    while(y)
    {
        t=x%y;
        x=y;
        y=t;
    }
    return  x;
}
int main()
{
    int i, j, k, l;
    int N, M;
    cin>>N >>M;
    for(i=1; i<=N; i++)
        for(j=1; j<=M; j++)
            gcd[i*j]=gd(i*j, M);
    f[0][0][1] = 1;
    for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
        for (k = 1; k <= M; k++)
            if (f[i][j][k] > 0)
                for (l = j + 1; l <= N - i; l++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX