193 条题解

  • 0
    @ 2007-06-12 11:34:43

    先求出 s:=y0 div x0

    再求出 n:=s有几个质因数

    输出 2^n

  • 0
    @ 2007-03-28 16:48:27

    这题数据太二哥了。最弱的法都能过。

    就成这样//orz

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 41ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 25ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:66ms

  • 0
    @ 2007-03-19 13:29:29

    我采用的寻找x*y的质因子数法,由于总是成对出现那么,质因子数只会在

    (x,sqrt(x*y))中出现,然后用x*y/当前的i得到另一个质因子数,判断它们

    是否是以x为最大公约数如果是那么就+2(因为是成对出现);

    但是注意如果i=sqrt(x*y)时,那么如果i成立就只+1,因为另一对和它一样..

  • 0
    @ 2007-03-11 00:08:00

    数据too弱,胡凑答案都能过!

  • 0
    @ 2007-02-25 19:00:43

    先求x0*y0即P*Q 再除以x0 再把所得数分解成两个质因数

    (包括1)

  • 0
    @ 2006-11-11 21:29:53

    找出不同的质因子的个数k,2^k就是答案,但是注意要将从x0中找出的从y0中剔去;

  • 0
    @ 2006-11-09 22:11:32

    用辗转相除法加上穷举法!!

  • 0
    @ 2006-11-03 13:03:18

    数据大小似乎没题目中指的那么大吧~

  • 0
    @ 2006-11-02 19:01:03

    数据太弱……本来想构造的 结果一个搜索居然就0ms ac了…………

    p:=x0;

    while p

  • 0
    @ 2006-10-30 19:00:40

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2006-10-16 20:49:27

    超时问题严重

    测试数据 01:运行超时...

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:运行超时...

    ├ 测试数据 04:答案正确... 166ms

    ├ 测试数据 05:运行超时...

    ,强烈鄙视数据!!!

  • 0
    @ 2006-10-15 17:52:07

    貌似求出(最小公倍数div最大公约数)的约数种类n,输出2^n

    汗(还要注意特殊情况……, 如果最小公倍数mod最大公约数0,无解)

  • 0
    @ 2006-09-25 15:04:03

    万恶!竟然会有X和Y MOD不等于0的情况!!

    郁闷了很久才猜到!!!

  • 0
    @ 2006-09-03 15:39:54

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2006-10-28 21:01:53

    这题目还是比较简单的.

    两数乘积/最大公约数=最小公倍数

    两数乘积=最大公约数*最小公倍数

    然后开个for 循环一个一个搜下去,判断的时候用个辗转相除法,速度很快的.

    我这样做耗时 0ms

  • 0
    @ 2006-08-20 21:27:41

    嗯,我也是用分解质因数。

    西门也真够牛的!

  • 0
    @ 2006-06-02 13:58:54

    "要求不能贴出任何有关于此题的程序代码!!"

  • -1
    @ 2017-07-22 17:18:38

    #include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <cstdio>
    #include <cstring>
    #include <cstdlib>
    #include <algorithm>
    #include <cctype>
    #include <vector>
    #include <queue>
    using namespace std;
    int zym(int a,int b)
    {
    int r=a%b;
    while(r!=0)
    {
    a=b;
    b=r;
    r=a%b;
    }
    return b;
    }
    int main()
    {
    int xO,yO,s=0;
    scanf("%d%d",&xO,&yO);
    for(int P=xO;P<=yO;P++)
    {
    for(int Q=xO;Q<=yO;Q++)
    {
    if(zym(P,Q)==xO&&(Q*P)/xO==yO)
    {
    s++;
    }
    }
    }
    printf("%d",s);
    return 0;
    }

  • -1
    @ 2017-03-14 22:13:02

    SB吧,输入还有y%x!=的情况,害的第四个数据一直不通过,想了半天

  • -1
    @ 2016-11-17 12:33:02

    简单数论推导。。
    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    #include <vector>

    using namespace std;

    /*
    gcd(a,b)=x
    a>=x
    b>=x
    lcm(a,b)=a*b/gcd(a,b)=y
    a*b=y*gcd(a,b)=x*y
    b=x*y/a (a=i*x --> b=y/i if y%i==0)
    */

    typedef long long int t;
    t x,y,ans;
    inline t gcd(t a,t b){return b?gcd(b,a%b):a;}
    int main(){
    scanf("%lld%lld",&x,&y);
    for(int i=1;i*x<=y;i++)
    ans+=!(y%i)&&gcd(i*x,y/i)==x;
    printf("%lld\n",ans);
    }

最小公倍数和最大公约数问题

信息

ID
1131
难度
4
分类
其他 | 数学搜索 | 枚举 点击显示
标签
递交数
7297
已通过
2964
通过率
41%
被复制
24
上传者