题解

184 条题解

  • 0
    @ 2008-12-28 18:18:23

    #include

    #include

    int main() {

    char word[101];

    int times[26]={0},i,l,maxn,minn,n;

    scanf("%s",word);

    for(i=0,l=strlen(word);i

  • 0
    @ 2008-12-24 18:19:07

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    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
    @ 2008-12-22 23:33:46

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2008-12-20 20:54:18

    提交考试的程序AC了。为什么考试时只有50分?

  • 0
    @ 2008-12-20 15:52:00

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    #include

    #include

    #include

    #include

    using namespace std;

    int zs(int maxn,int minn){

    int i,s=maxn-minn;

    for (i=2;i

  • 0
    @ 2008-12-19 17:21:22

    编译通过...

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

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

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

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

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

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

     ├ 错误行输出

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

     ├ 错误行输出

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

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

    var

    j:char;

    s:string;

    i,max,min,pi:integer;

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

    procedure ff(pi:integer);

    var i:integer;

    begin

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

    if pi mod i=0

    then exit;

    writeln('Luxky Word');

    writeln(pi);

    halt;

    end;

    begin

    readln(s);

    fillchar(a,sizeof(a),0);

    pi:=length(s);

    for i:=1 to pi do

    inc(a[s[i]]);

    min:=maxint;

    max:=0;

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

    if a[j]0

    then begin

    if a[j]max

    then max:=a[j];

    end;

    if max-min>1

    then ff(max-min);

    writeln('No Answer');

    writeln('0');

    end.

    大牛看错

  • 0
    @ 2008-12-19 16:58:17

    考试时打错了文件啊!!!

  • 0
    @ 2008-12-15 14:38:13

    program p1495;

    var

    ch:char;

    maxn,minn:byte;

    f1:array['a'..'z'] of byte;

    f2:array['a'..'z'] of boolean;

    function prime(x:byte):boolean;

    var

    i:byte;

    begin

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

    if x mod i=0

    then exit(false);

    exit(true);

    end;

    begin

    fillchar(f1,sizeof(f1),0);

    fillchar(f2,sizeof(f2),false);

    while not(eoln) do

    begin

    read(ch);

    inc(f1[ch]);

    f2[ch]:=true;

    end;

    maxn:=0;minn:=255;

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

    begin

    if f1[ch]>maxn

    then maxn:=f1[ch];

    if (f1[ch]=2)

    then begin

    writeln('Lucky Word');

    writeln(maxn-minn);

    end

    else begin

    writeln('No Answer');

    writeln(0);

    end;

    end.

    301个通过

  • 0
    @ 2008-12-15 13:44:32

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    一次AC...

    program p1495;

    var

    ch:char;

    maxn,minn:byte;

    f1:array['a'..'z'] of byte;

    f2:array['a'..'z'] of boolean;

    function prime(x:byte):boolean;

    var

    i:byte;

    begin

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

    if x mod i=0

    then exit(false);

    exit(true);

    end;

    begin

    fillchar(f1,sizeof(f1),0);

    fillchar(f2,sizeof(f2),false);

    while not(eoln) do

    begin

    read(ch);

    inc(f1[ch]);

    f2[ch]:=true;

    end;

    maxn:=0;minn:=255;

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

    begin

    if f1[ch]>maxn

    then maxn:=f1[ch];

    if (f1[ch]=2)

    then begin

    writeln('Lucky Word');

    writeln(maxn-minn);

    end

    else begin

    writeln('No Answer');

    writeln(0);

    end;

    end.

  • 0
    @ 2008-12-15 13:43:35

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    一次AC...

    program p1495;

    var

    ch:char;

    maxn,minn:byte;

    f1:array['a'..'z'] of byte;

    f2:array['a'..'z'] of boolean;

    function prime(x:byte):boolean;

    var

    i:byte;

    begin

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

    if x mod i=0

    then exit(false);

    exit(true);

    end;

    begin

    fillchar(f1,sizeof(f1),0);

    fillchar(f2,sizeof(f2),false);

    while not(eoln) do

    begin

    read(ch);

    inc(f1[ch]);

    f2[ch]:=true;

    end;

    maxn:=0;minn:=255;

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

    begin

    if f1[ch]>maxn

    then maxn:=f1[ch];

    if (f1[ch]=2)

    then begin

    writeln('Lucky Word');

    writeln(maxn-minn);

    end

    else begin

    writeln('No Answer');

    writeln(0);

    end;

    end.

  • 0
    @ 2008-12-14 21:43:55

    好难。。。。

  • 0
    @ 2008-12-14 20:12:46

    诶~~~

    今年的题都是氢氧化氢

    强酸加强碱阿

  • 0
    @ 2008-12-14 18:40:36

    本菜题解:

    http://hi.baidu.com/x50946702/blog/item/20578d34af4fc78ca71e1243.html

    欢迎观看!感谢留言~!

  • 0
    @ 2008-12-14 13:21:21

    编译通过...

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

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

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

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

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

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

     ├ 错误行输出

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

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

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

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

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

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

    var

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

    max,min,i,t:integer;

    ch:char;

    str:string;

    function qzs(f:integer):boolean;

    var

    i:integer;

    begin

    qzs:=true;

    if f=1 then

    begin

    qzs:=false;

    exit;

    end;

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

    if f mod i=0 then

    begin

    qzs:=false;

    break;

    end;

    end;

    begin

    readln(str);

    fillchar(ans,sizeof(ans),0);

    for i:=1 to length(str) do

    inc(ans[str[i]]);

    max:=0;

    min:=100;

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

    begin

    if ans[ch]>max then max:=ans[ch];

    if (ans[ch]

  • 0
    @ 2008-12-13 19:54:25

    水啊

    好水啊

    好多水啊

  • 0
    @ 2008-12-13 19:38:28

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var

    s:string;

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

    i,max,min:longint;

    c:char;

    function modular_exp(a,b,c:longint):int64;

    var

    i,j:longint;

    x:int64;

    er:array[1..32]of longint;

    begin

    j:=0;

    while b0 do

    begin

    inc(j);

    er[j]:=b and 1;

    b:=b shr 1;

    end;

    x:=1;

    for i:=j downto 1 do

    begin

    if er[i]=0

    then x:=sqr(x) mod c

    else x:=sqr(x) mod c*a mod c;

    if x=1

    then exit(1);

    end;

    exit(x);

    end;

    function MillerRabbin(n:longint):boolean;

    var

    i,x:longint;

    begin

    if n=0 then exit(false);

    if n=1 then exit(false);

    if n=2 then exit(true);

    for i:=1 to 1 do

    begin

    x:=random(n-2)+2;

    if modular_exp(x,n-1,n)1

    then exit(false);

    end;

    exit(true);

    end;

    begin

    readln(s);

    for i:=1 to length(s) do

    begin

    inc(b[s[i]]);

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

    end;

    min:=maxlongint;

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

    if (b[c]0)

    then min:=b[c];

    if millerrabbin(max-min)

    then begin

    writeln('Lucky Word');

    writeln(max-min);

    end

    else begin

    writeln('No Answer');

    writeln(0);

    end;

    end.

    Monte Carlo 我 s 设到 1 就AC了,rp不错

  • 0
    @ 2008-12-13 17:18:56

    NOIP...一年不如一年

  • 0
    @ 2008-12-13 15:50:25

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    用 Monte Carlo 费马小定理素数判定,s设到10(99.999999046326%)

    如果不能AC只能说明我人品差的不行了

  • 0
    @ 2008-12-12 20:45:25

    var

    s:string;

    i,j,t,k:longint;

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

    function ss(a1:longint):boolean;

    var

    i:integer;

    begin

    if a1=1 then ss:=false else

    begin

    i:=a1;ss:=false;

    repeat

    i:=i-1;

    until (a1 mod i=0)or(ia[j] then

    begin

    t:=a[i];a[i]:=a[j];a[j]:=t;

    end;

    i:=0;

    repeat

    inc(i);

    if a[i]0 then a[1]:=a[i];

    until a[i]0;

    if ss(a[26]-a[1]) then

    begin

    writeln('Lucky Word');

    writeln(a[26]-a[1]);

    end

    else begin

    writeln('No Answer');

    writeln('0');

    end;

    readln

    end.

    WA了次,主要是我这垃圾的 判断素数,先忘记考虑数为1的情况,只有60分`\`

    真可恶,这次2008NOIP的提高组和普及组的第一题都是两次才AC,普及组那题就是忘了考虑输入为‘X’的情况(虽然考虑了输出情况)

  • 0
    @ 2008-12-12 20:09:32

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    秒杀

    #include

    const int N=10001;

    int main()

    {

    int a[N]={0},b,c,d=0,e=10000,f;

    char g[N]={'0'};

    scanf ("%s",g);

    for (b=0;b

信息

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