View Code of Problem 102

#include<stdio.h>
typedef struct {
    int a;
    int b;
}KK;
int main() {
    int x0, y0;
    int m = 0;

    while (scanf("%d %d", &x0, &y0) != EOF) {
        int count = 0;
        KK k[10000];
        for (int i = x0; i <= y0; i++)
        {
            for (int j = x0; j <= y0; j++)
            {
                if ((x0 * y0) / i == j) {
                    k[m].a = i;
                    k[m].b = j;
                    m++;
                }
            }
        }
        for (int i = 0; i < m; i++)
        {
            for (int j = 1; j <= y0; j++)
            {
                if ((k[i].a * j) % k[i].b == 0)
                {
                    if (k[i].a * j == y0)
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
        printf("%d\n", count);
    }
 
    return 0;
}

Double click to view unformatted code.


Back to problem 102