题解

184 条题解

  • 0
    @ 2009-04-02 12:48:17

    我的题解:

    program sdk;

    var a:array['a'..'z']of longint;

    var str1:string;q:char;i,t,max,min:longint;

    function sushu(n:longint):boolean;

    var i:longint;

    begin

    sushu:=true;if (n=1)or(n=0) then begin sushu:=false;exit;end;

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

    if n mod i=0 then begin sushu:=false;break;end;

    end;

    begin

    read(str1);

    for i:=1 to length(str1) do

    a[str1[i]]:=a[str1[i]]+1;

    min:=maxlongint;

    for q:='a' to 'z' do begin

    if a[q]>max then max:=a[q];

    if (a[q]0) then min:=a[q];

    end;

    max:=max-min;

    if sushu(max) then begin writeln('Lucky Word');writeln(max);end

    else begin writeln('No Answer');writeln(0);end;

    end.

  • 0
    @ 2009-03-31 21:01:02

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    program ma;

    var

    i,max,min:longint;

    s:string;

    a:array['a'..'z'] of longint;

    function ss(a:longint):boolean;

    var

    i:longint;

    begin

    ss:=false;

    if (a=1)or(a=0) then

    exit;

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

    if a mod i=0 then

    exit;

    ss:=true;

    end;

    begin

    readln(s);

    max:=0;

    min:=maxlongint;

    for i:=1 to length(s) do

    begin

    inc(a[s[i]]);

    if a[s[i]]>max then

    max:=a[s[i]];

    end;

    for i:=1 to length(s) do

    if a[s[i]]

  • 0
    @ 2009-03-20 13:23:03

    var p,i,j,l,f,e,t:integer;

    n:string;

    a:array[1..100] of string;

    b:array[1..100] of integer;

    begin

    readln (n);

    l:=length(n);

    for i:=1 to l do

    a[i]:=copy(n,i,1);

    for i:=1 to l-1 do begin

    if a[i]'0' then f:=f+1;

    for j:=i+1 to l do begin

    if (a[i]=a[j]) and (a[j]'0') then begin a[j]:='0';b[f]:=b[f]+1;end;

    end;

    end;

    for i:=1 to f-1 do begin

    for j:=i+1 to f do begin

    if b[i]1 then p:=b[1]-b[f];

    for i:=2 to p div 2 do begin

    if p mod i=0 then e:=1;

    end;

    if (p=1) or (p=0) then begin writeln ('No Answer');writeln ('0');end;

    if (e1) and (p1) and (p0) then begin writeln ('Lucky Word');writeln (p);end;

    if e=1 then begin writeln ('No Answer');writeln ('0');end;

    readln;

    end.

  • 0
    @ 2009-03-03 19:05:49

    program word;

    var a:array['a'..'z'] of integer; c:char;

    s:string;

    n,m:integer; min , max:longint;

    b:boolean;

    begin

    b:=true;

    read (s);

    for n:=1 to length(s) do

    inc(a[s[n]]);

    min:=maxlongint;

    max:=0;

    for c:='a' to 'z' do begin

    If (a[c]=1) then min:=a[c];

    If a[c]>max then max:=a[c];

    end;

    m:=max-min; If n

  • 0
    @ 2009-03-01 19:32:31

    Program bxh;

    Var

    s:string[255];

    a:array [1..26] of integer;

    i,j,max,min,b,d:integer;

    p:boolean;

    Begin

    readln(s);

    p:=true;

    for i:=1 to 26 do

    a[i]:=0;

    for i:=1 to length(s) do

    for j:=1 to length(s) do

    if (s[i]=s[j]) then inc(a[i]);

    max:=a[1];

    min:=a[1];

    for i:=1 to length(s) do

    begin

    if (a[i]>max) then max:=a[i];

    if (a[i]

  • 0
    @ 2009-02-28 23:40:04

    var i,j,max,min,num:longint;

    s:string;

    a:array['a'..'z'] of integer;

    b:boolean;

    begin

    readln(s);

    min:=maxlongint;

    max:=0;

    for i:=1 to length(s) do

    begin

    inc(a[s[i]]);

    if a[s[i]]>max then max:=a[s[i]];

    if a[s[i]]

  • 0
    @ 2009-02-26 19:04:33

    function sushu(n:integer): Boolean;

    var I:integer;

    begin

    for I:=2 to trunc(sqrt(n)) do

    if n mod I=0 then begin

    sushu:=false; exit;

    end;

    sushu:=true;

    end;

    var

    i,j,k,l,m,n,b,p,min,max:integer;

    s:string;

    a:array[1..25]of integer;

    begin

    min:=3000;

    read(s);

    p:=length(s);

    for i:=1 to p do

    begin

    b:=ord(s[i])-96;

    a:=a+1;

    end;

    i:=1;

    for i:=1 to 24 do

    begin

    if a[i]>max then max:=a[i];

    if (a[i]1) then begin writeln('Lucky Word'); writeln(max-min);end else begin writeln('No Answer'); writeln('0');end;

    end.

  • 0
    @ 2009-02-22 15:46:19

    Program danchi;

    Var   s:string[100];

        a:array [1..26] of integer;

        i,j,max,min,b,d:integer;

    Begin

        readln(s);

       for i:=1 to 26 do

        a[i]:=0;

       for i:=1 to length(s) do

       for j:=1 to length(s) do

       if (s[i]=s[j]) then inc(a[i]);

        max:=a[1]; min:=a[1];

       for i:=1 to length(s) do

       begin

         if (a[i]>max) then max:=a[i];

         if (a[i]trunc(sqrt(b)))

         then begin writeln('Lucky Word');

               writeln(b);

           end

         else begin

               writeln('No Answer');

               writeln('0');

           end;

           end;

    End.

  • 0
    @ 2009-02-15 18:54:01

    program p1495;

    var i,j,k,l,max,min:longint;

    a:array ['a'..'z'] of longint;

    s:string;

    c:char;

    f:boolean;

    begin

    readln(s);

    for i:=1 to length(s) do inc(a[s[i]]);

    min:=maxlongint;

    for c:='a' to 'z' do

    begin

    if a[c]>max then max:=a[c];

    if (a[c]0) then min:=a[c];

    end;

    l:=max-min;

    f:=true;

    for i:=2 to round(sqrt(l)) do

    if l mod i=0 then begin f:=false;break;end;

    if (f)and(l>1) then begin writeln('Lucky Word');writeln(l);end

    else begin writeln('No Answer');writeln(0);end;

    end.

    晕死~~交了2次 第一次忘了1不是质数。

  • 0
    @ 2009-02-12 16:45:35

    Program danchi;

    Var   s:string[100];

        a:array [1..26] of integer;

        i,j,max,min,b,d:integer;

    Begin

        readln(s);

       for i:=1 to 26 do

        a[i]:=0;

       for i:=1 to length(s) do

       for j:=1 to length(s) do

       if (s[i]=s[j]) then inc(a[i]);

        max:=a[1]; min:=a[1];

       for i:=1 to length(s) do

       begin

         if (a[i]>max) then max:=a[i];

         if (a[i]trunc(sqrt(b)))

         then begin writeln('Lucky Word');

               writeln(b);

           end

         else begin

               writeln('No Answer');

               writeln('0');

           end;

           end;

    End.

  • 0
    @ 2009-02-03 09:46:16

    编译通过...

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

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

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

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

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

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

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

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

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

    ├ 测试数据 10:答案错误... ├ 标准行输出

     ├ 错误行输出

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

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

    Program danchi;

    Var s:string[100];

    a:array [1..26] of integer;

    i,j,max,min,b,d:integer;

    Begin

    readln(s);

    for i:=1 to 26 do

    a[i]:=0;

    for i:=1 to length(s) do

    for j:=1 to length(s) do

    if (s[i]=s[j]) then inc(a[i]);

    max:=a[1]; min:=a[1];

    for i:=1 to length(s) do

    begin

    if (a[i]>max) then max:=a[i];

    if (a[i]trunc(sqrt(b)))

    then begin writeln('Lucky Word');

    writeln(b);

    end

    else begin

    writeln('No Answer');

    writeln('0');

    end;

    end;

    End.

  • 0
    @ 2009-01-27 22:38:16

    知道过氧化氢碰到二氧化锰会产生什么吗?除了氧气还有这道题^_^the 7th

  • 0
    @ 2009-01-23 21:09:54

    我比笨小猴还笨

    NOIP300,第一题70

    P.S 俺是浙江的

    55555~~~~~~~~~~~~

  • 0
    @ 2009-01-17 19:12:25

    第601个………………水水

    #include

    using namespace std;

    ifstream fin("word.in");

    ofstream fout("word.out");

    bool zs(int l)

    {

    int i=2;

    for(;i>s;

    for(i=0;i

  • 0
    @ 2009-01-17 14:01:39

    void minmax(int *data, int *min, int *max, int leng)

    {

    int *p=data;

    *min=*max=*p;

    p++;

    for(int i=leng;i>1;i--)

    {

    if(*p*max)

    *max=*p;

    p++;

    }

    }

    char checkprime(int a)

    {

    if(a==0 || a==1)

    return 1;

    for(int i=2;i

  • 0
    @ 2009-01-17 09:57:14

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    program p1495;

    var

    i,j,a,b,d,x,u,da,xiao:integer;

    s:string;

    y:array[97..122] of integer;

    begin

    read(s);

    a:=length(s);

    for i:=1 to a do

    y[ord(s[i])]:=y[ord(s[i])]+1;

    i:=97;

    while y[i]=0 do

    begin

    u:=u+1;

    i:=i+1;

    end;

    d:=y[97];

    x:=y[97+u];

    for i:=98 to 122 do

    begin

    if y[i]>=d then d:=y[i];

    if (x>=y[i])and(y[i]0) then x:=y[i];

    end;

    for i:=2 to trunc(sqrt(d-x)) do

    if ((d-x) mod i)=0 then j:=j+1;

    if (j0)or(d-x=0)or(d-x=1) then

    begin

    writeln('No Answer');

    write('0');

    end

    else

    begin

    writeln('Lucky Word');

    write(d-x);

    end;

    end.

  • 0
    @ 2009-01-15 10:01:15

    var

    s:string;

    la,ls,x1,i,x,j,t:integer;

    a:array[1..27]of integer;

    begin

    read(s);

    ls:=length(s); x1:=ord('a')-1;

    la:=length(a);

    for i:=1 to ls do

    begin

    x:=ord(s[i])-x1;

    inc(a[x]);

    end;

    for i:=1 to la do

    for j:=1 to la-i do

    if a[j]

  • 0
    @ 2009-01-01 20:33:37

    program p1495;

    var max,min,x,i,j,t:longint;

      s:string;

    procedure print1;

    begin

    writeln('No Answer');

    writeln('0');

    end;

    procedure print2;

    begin

    writeln('Lucky Word');

    writeln(x);

    end;

    begin

    readln(s);max:=0;min:=65555;

    for i:=1 to 26 do

    begin

    t:=0;

    for j:=1 to length(s) do if s[j]=chr(96+i) then inc(t);

    if t>max then max:=t; if t2 then for i:=2 to trunc(sqrt(x)) do if (x mod i)=0 then begin print1; halt; end;

    print2;

    end.

  • 0
    @ 2008-12-31 19:06:27

    program p1495;

    var max,min,x,i,j,t:longint;

    s:string;

    procedure print1;

    begin

    writeln('No Answer');

    writeln('0');

    end;

    procedure print2;

    begin

    writeln('Lucky Word');

    writeln(x);

    end;

    begin

    readln(s);max:=0;min:=65555;

    for i:=1 to 26 do

    begin

    t:=0;

    for j:=1 to length(s) do if s[j]=chr(96+i) then inc(t);

    if t>max then max:=t; if t2 then for i:=2 to trunc(sqrt(x)) do if (x mod i)=0 then begin print1; halt; end;

    print2;

    end.

    为什么只80分 hlep!

  • 0
    @ 2008-12-28 12:46:35

    第500个。

信息

ID
1495
难度
5
分类
模拟 点击显示
标签
递交数
9619
已通过
3487
通过率
36%
被复制
16
上传者