193 条题解

  • 0
    @ 2012-10-15 19:28:49

    here--点击

  • 0
    @ 2012-08-14 15:13:22

    100%纯水题

    同志们,有水题,刷啊!!

    水题不刷,天理难容!!!

    滚滚长江都是水啊!!!

    好水~~~~~~~~~~~

    这数据,枚举都能过!!!

  • 0
    @ 2012-07-28 23:38:05

    水题中的水题,呵呵!!

  • 0
    @ 2010-04-03 12:59:26

    program p1131;

    var

    y0,x0,n,p,q,i,j,t,sum:longint;

    function gcd(a,b:longint):longint;

    begin

    if b=0 then gcd:=a else gcd:=gcd(b,a mod b);

    end;

    begin

    read(x0,y0);

    n:=y0 div x0;

    for i:=1 to trunc(sqrt(n)) do

    if (n mod i=0)and(gcd(i,n div i)=1) then inc(sum);

    writeln(sum*2);

    end.

  • 0
    @ 2009-11-06 16:20:23

    program p1131;

    var x,y,i,o:integer;

    begin

    readln(x,y);

    if y mod x0 then

    begin

    writeln(0);

    halt;

    end;

    o:=0;

    y:=y div x;

    for i:=2 to (y-1) do

    if y mod i=0 then

    begin

    inc(o);

    while y mod i =0 do y:=y div i;

    end;

    writeln(o*(o-1)+2);

    end.

    直接ac

  • 0
    @ 2009-11-03 09:48:19

    var

    f,d:array[1..1000000]of boolean;

    num,ans,k,t,i,j,x,y:longint;

    begin

    readln(x,y);

    if y mod x0 then begin writeln(0);halt; end;

    k:=y div x;

    fillchar(f,sizeof(f),true);

    f[1]:=false;

    i:=2;

    while i

  • 0
    @ 2009-10-27 16:21:24

    暴力法。。

    1、gcd(m,n)*lcm(m,n)=m*n,通过这个枚举m,1m两种情况。

  • 0
    @ 2009-10-25 08:44:54

    program noip9901;

    var i,j,sum,m,n:longint;

    function gcd(a,b:longint):longint;

    begin

    if (a mod b=0)then gcd:=b

    else gcd:=gcd(b,a mod b);

    end;

    begin

    readln(m,n);

    for i:=1 to 500000 do

    begin

    for j:=1 to n*m div i do

    if (gcd(i,j)=m) and (i*j div gcd(i,j)=n)

    then

    inc(sum);

    end;

    writeln(sum);

    readln;

    end.

  • 0
    @ 2009-10-17 17:41:51

    类似于楼下jungle的方法。。。。。。。。。。。

    只开了一个数组,然后高精度。。。

    不过最后一个测试数据有一点阴险,

    最后一个数据:p mod q0,所以直接判断出不存在这样的两个数,害我WA了一次

  • 0
    @ 2009-10-15 21:34:31

    飘过.....

    好水的题......

  • 0
    @ 2009-10-10 19:48:07

    编译通过...

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

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

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

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

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

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

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

    program p1131;

    var

    x,y:longint;

    i,n,t:integer;

    function f(n:integer):longint;

    var

    i:integer;

    begin

    f:=2;

    for i:=1 to n-1 do

    f:=f*2;

    end;

    begin

    readln(x,y);

    if(y mod x0) then begin writeln(0); halt end;

    if(x=y)or(x=0)then begin writeln(2); halt end;

    y:=y div x;

    n:=y-1;

    i:=2; t:=0;

    while (i1) do

    begin

    if y mod i=0 then

    begin inc(t);

    while y mod i=0 do y:=y div i;

    end;

    inc(i);

    end;

    writeln(f(t));

    end.

    我的方法和Jungle的不谋而合

  • 0
    @ 2009-09-24 19:16:42

    就拿样例来说

    y=60=2*2*3*5

    x=3=3

    60/3=2*2*5;

    设集合A为{2,2,5}

    如果a,b的最大公约数和最小公倍数是3和60

    那么a=3*集合B b=3*集合C

    其中集合B+集合C=集合A

    (这里表达比较有问题大家不要计较= =)

    如果集合B和集合C里面都有一个2

    那么a和b肯定存在相同的因数为3*2

    就不符合a,b的最大公约数为3的条件

    所以集合B和集合C中不能有相同的质因数

    也就是说

    a=3*2*2 b=3*5是合法的

    a=3*2 b=3*2*5是不合法的

    如果不同质因数的个数是N个

    每种质因数可以取或不取

    对于集合B来说有2^n种选择方法

    而集合C与集合B一一对应

    所以总的方法数就是2^n了

  • 0
    @ 2009-09-18 18:18:32

    var x,y,p,i,k,g:longint;

    function gcd(m,n:longint):longint;

    begin

    if m=0 then gcd:=n

    else gcd:=gcd(n mod m ,m);

    end;

    begin

    readln(x,y); k:=0;

    for i:=x to y do

    if (i mod x=0) and ((x*y div i) mod x=0) and (y mod i=0) and (y mod (x*y div i)=0) then

    begin

    if i(x*y div i) then begin

    g:=gcd(x*y div i,i);

    if g=x then inc(k);

    end;

    end;

    writeln(k);

    end.

  • 0
    @ 2009-09-12 21:13:16

    编译通过...

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

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

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

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

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

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

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

    太假了。枚举多加几个判断is OK!

  • 0
    @ 2009-09-12 10:22:50

    先求出 s:=y0 div x0

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

    输出 2^n

    1、这个题数据很弱,不像它说的

    2、学习了一下题解的做法,仍不知为何,还是背过吧。。。

    3、这个题也挺诡异

    编译通过...

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

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

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

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

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

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

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

    const filename='p1131';

    var

    x0,y0,n,s,i,x:longint;

    a:array[1..1000]of boolean;

    begin

    assign(input,filename+'.in');reset(input);

    assign(output,filename+'.out');rewrite(output);

    readln(x0,y0);

    if y0 mod x00 then writeln(0)

    else begin

    n:=y0 div x0;s:=0;;

    for i:=2 to n do

    if not(a[i])then

    begin

    if n mod i =0 then inc(s);

    x:=2*i;

    repeat

    a[x]:=true;

    x:=x+i;

    until(x>n)

    end;

    writeln(1 shl s);

    end;

    close(input);close(output);

    end.

  • 0
    @ 2009-09-05 17:15:09

    汗...

    数据好弱...

  • 0
    @ 2009-08-29 15:57:13

    program dax;

    var x,y,i,tot:longint;

    function gcd(x,y:longint):longint;

    var t:longint;

    begin

    if x

  • 0
    @ 2009-08-27 13:03:35

    沉默々泽

    var

    i,j,x0,y0,k:longint;

    function can(i,j:longint):boolean;

    var a,b,t:longint;

    begin

    a:=i; b:=j; t:=j mod i;

    while t0 do

      begin j:=i; i:=t; t:=j mod i; end;

    if(i=x0)and(a*b div i=y0)then

      can:=true else can:=false;

    end;

    begin

    read(x0,y0); k:=0;

    for i:=x0 to y0 do

      for j:=i+1 to y0 do

       if can(i,j) then

        inc(k);

    write(2*k);

    end.

  • 0
    @ 2009-08-26 19:03:21

    好阴险

    竟然有不可能的情况

    还以为都可以

    直接 整除

    ···········

    program xiti;

    var i,j,xx,yy,s,p,ans:longint;

    ok:boolean;

    begin

    readln(xx,yy);

    if yy mod xx0 then

    begin

    writeln(0);

    halt;

    end;

    s:=yy div xx;

    ans:=0;

    for i:=1 to s do

    if (s mod i=0)and(i

  • 0
    @ 2009-08-19 17:07:18

    编译通过...

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

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

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

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

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

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

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

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

信息

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