193 条题解

  • 0
    @ 2008-11-02 16:57:04

    开始没判断y0 mod x0...结果第四个点错了。。。

    加上AC...

  • 0
    @ 2008-10-31 20:53:44

    var

    h:Array[1..1000] of boolean;

    p:Array[1..1000] of longint;

    x,y,t,n,i,j,ans:longint;

    procedure findprime;

    var i,j:longint;

    begin

    for i:=2 to trunc(sqrt(t)) do

    if not h[i] then

    for j:=2 to t div i do

    h:=true;

    for i:=2 to t do

    if not h[i] then

    begin

    inc(n);

    p[n]:=i;

    end;

    end;

    begin

    read(x,y);

    t:=y div x;

    findprime;

    ans:=1;

    for i:=1 to n do

    begin

    if t mod p[i] = 0 then ans:=ans*2;

    while t mod p[i]=0 do t:=t div p[i];

    end;

    if t1 then ans:=ans*2;

    if (y mod x = 0) and (y>x) then writeln(ans)

    else writeln(0);

    end.

  • 0
    @ 2008-10-29 16:22:12

    编译通过...

    ├ 测试数据 01:答案错误...程序输出比正确答案长

    ├ 测试数据 02:答案错误...程序输出比正确答案长

    ├ 测试数据 03:答案错误...程序输出比正确答案长

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

    ├ 测试数据 05:答案错误...程序输出比正确答案长

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

    Unaccepted 有效得分:20 有效耗时:0ms

    program p1131;

    var x,y,p,q,i,j,s:longint;

    procedure g(m,n:longint);

    var r:longint;

    begin

    r:=m mod n;

    if r=0 then p:=n

    else g(n,r);

    end;

    begin

    readln(x,y);

    for i:=x to y do

    begin

    if y mod i=0 then

    begin

    q:=(y div i)*x;

    g(i,q);

    if p=x then inc(s);

    end;

    end;

    writeln(s);

    end.

    日……

    调试的时候把I,Q都打出来……提交的时候忘记改回来了……

    现在AC了……

  • 0
    @ 2008-10-25 10:00:51

    #include

    using namespace std;

    unsigned long long x,y,s;

    int sub(int a,int b);

    int main()

    {

    cin>>x>>y;s=x*y;

    //cout

  • 0
    @ 2008-10-23 13:36:07

    编译通过...

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

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

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

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

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

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

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

    水啊啊啊啊啊啊...

  • 0
    @ 2008-10-19 22:40:40

    编译通过...

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

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

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

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

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

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

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

    var

    max,x,y,i,j:integer;

    function ye:boolean;

    var z,i1:integer;

    begin

    if i>j then z:=i else z:=j;

    for i1:=z downto x+1 do

    if (i mod i1=0)and(j mod i1=0) then begin ye:=false; exit; end;

    if (i mod x=0)and(j mod x=0) then ye:=true;

    end;

    begin

    readln(x,y);

    max:=0;

    for i:=1 to y do

    if (i mod x=0) and (y mod i=0) then begin

    j:=(y div i)*x;

    if ye then max:=max+1;

    end;

    writeln(max);

    end.

  • 0
    @ 2008-10-11 19:57:04

    没什么好讲的..很水的题..

    找出不同质因子..

    要注意判断是否可能有解..

    又浪费AC率了..

  • 0
    @ 2008-10-11 08:05:15

    疯了!!我写得这么烂的程序都轻易AC

    #include

    long x0,y0,ans;

    long gcd(long a,long b)

    {

    if(b==0) return a;

    else return gcd(b,a%b);

    }

    int main()

    {

    long P,Q;

    scanf("%ld%ld",&x0,&y0);

    ans=0;

    for(P=x0;P

  • 0
    @ 2008-09-24 19:16:38

    记录号 Flag 得分 记录信息 环境 评测机 程序提交时间

    R863176 Accepted 100 From 695202454-

      P1131 FPC Vivid Puppy 2008-9-24 19:16:12

    From zhouyc

    最小公倍数和最大公约数问题 全国青少年信息学奥林匹克分区联赛 (NOIp) 竞赛原题

    编译通过...

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

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

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

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

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

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

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

    haha

  • 0
    @ 2008-09-21 19:26:42

    编译通过...├ 测试数据 01:答案正确... 0ms├ 测试数据 02:答案正确... 0ms├ 测试数据 03:答案正确... 0ms├ 测试数据 04:答案正确... 0ms├ 测试数据 05:答案正确... 0ms-------------------------Accepted 有效得分:100 有效耗时:0ms

    枚举王道!!! 先枚举 p , 如果 (p mod x0=0)and(y0 mod p=0) 则 begin q=( y0 div p ) * x0;(用数学方法可证); 假如 p,q的 最大公约数 为 x0 则 inc(ans); end;

  • 0
    @ 2008-09-20 19:50:41

    编译通过...

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

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

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

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

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

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

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

  • 0
    @ 2008-09-20 13:05:43

    编译通过...

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

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

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

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

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

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

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

    var x,y,z,num,k,j,i:longint;

    f:array[1..1000000]of longint;

    begin

    readln(x,y);

    if y mod x0 then

    begin

    writeln(0);

    halt;

    end;

    fillchar(f,sizeof(f),0);

    for i:=2 to 1000000 do

    if f[i]=0 then

    begin

    j:=i*2;

    while j1 do

    begin

    inc(z);

    if f[z]=1 then continue;

    k:=0;

    while y mod z=0 do

    begin

    inc(k);

    y:=y div z;

    end;

    while x mod z=0 do

    begin

    dec(k);

    x:=x div z;

    end;

    if k>0 then num:=num*2;

    end;

    writeln(num);

    end.

  • 0
    @ 2008-09-19 20:53:14

    编译通过...

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

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

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

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

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

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

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

    我用的是

    ‘失落只为你’大牛的做法。。。好快啊

  • 0
    @ 2008-09-16 23:41:21

    太经典的纯数学的功底,需要了解,就是求互质因子个数

    #include

    #include

    using namespace std;

    //ifstream fin("2.in");

    //ofstream fout("2.out");

    int judge(int a,int b)

    {

    int i;

    i=a%b;

    while(i!=0){

    a=b;b=i;i=a%b;

    }

    return b;

    }

    int count(int k)

    {

    int i,n=0;

    for(i=1;i>m>>n;

    if(n%m!=0) cout

  • 0
    @ 2008-09-16 21:31:35

    其实很简单

    只要用这个程序就OK了o(∩_∩)o...哈哈

    program zui;

    var tot,x0,y0,i,lcd:longint;

    function huzhi(x,y:longint):boolean;

    var i:longint;

    begin

    if (x=1)or(y=1) then huzhi:=true else

    if (x

  • 0
    @ 2008-09-15 22:51:10

    我用‘失落只为你’的方法A了,但是还是想不清楚,可不可以给个推导?

  • 0
    @ 2008-09-13 13:49:15

    编译通过...

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

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

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

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

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

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

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

    数据太弱,直接枚举

    以x0为最大公约数,y0为小公倍数的两个数的积就等于x0*y0,

    for i:=1 to trunc(sqrt(x0*y0))枚举,判断gdc(i,trunc(sqrt(x0*y0))div i)=x0就可以了。每次加2(因为我只枚举到sqrt(x0*y0),而3 60与60 3算两组)。

  • 0
    @ 2008-09-07 19:33:01

    编译通过...

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

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

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

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

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

  • 0
    @ 2008-08-24 20:17:47

    判断:y0 mod x00则输出0

    统计(y0/x0)的质因子种类s

    有二项式定理 2^s=(1+1)^s=c(0,s)+c(1,s)+...+c(s,s)

    输出2^s

    ac

  • 0
    @ 2008-08-23 20:27:03

    求最大公约数可用尼考曼彻斯法,或用辗转相除判余法。

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

信息

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