1 条题解

  • 0
    @ 2025-2-21 20:03:46

    C++ :

    #include <cstdio>
    using namespace std;
    int gcd(int x, int y)
    {
        int t;
        while(y > 0){
            t = x % y;
            x = y;
            y = t;
        }
        return x;
    }
    
    int main()
    {
        int i, ans = 0;       
        int x, y, t, s;
        scanf("%d%d", &x, &y);
        t = x * y;
        for(i = x; i <= y; i += x){
            s = t / i;
            if((s * i == t) && (gcd(s, i) == x)){
                ans++;
            }
        }
        printf("%d\n", ans);
        return 0;
    }
    
    
    • 1

    信息

    ID
    1026
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者