题解

184 条题解

  • 0
    @ 2008-12-12 19:05:23

    什么叫牛,这题..wa了一次。

  • 0
    @ 2008-12-12 15:21:10

    NOIP2008提高组第一题`……太水了!

    AC……

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    function ji(n:integer):boolean;

    var

    i:integer;

    begin

    if n=0 then exit(false);

    if n=1 then exit(false);

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

    if n mod i=0 then exit(false);

    exit(true);

    end;

    var

    s:string;

    i,min,max,n:integer;

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

    begin

    readln(s);

    for i:=1 to length(s) do

    inc(h[ord(s[i])-ord('a')+1]);

    max:=0;

    for i:=1 to 26 do if (h[i]>max) and (h[i]0) then max:=h[i];

    min:=maxint;

    for i:=1 to 26 do if (h[i]

  • 0
    @ 2008-12-12 15:01:29

    一次AC……

    考试时也是……

  • 0
    @ 2008-12-12 13:26:29

    var

    ss:set of 0..100;

    s:string;

    max,min,len,i,tmp:integer;

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

    begin

    ss:=[];

    ss:=ss+[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,91,97];

    max:=0; min:=32767;

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

    readln(s);

    len:=length(s);

    for i:=1 to len do

    begin

    tmp:=ord(s[i])-ord('a')+1;

    a[tmp]:=a[tmp]+1;

    end;

    for i:=1 to 26 do

    begin

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

    if (a[i]

  • 0
    @ 2008-12-11 21:59:28

    水啊。。。。我这种菜鸟3分钟都能编出来

  • 0
    @ 2008-12-11 21:26:14

    编译通过...

    ├ 测试数据 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-11 21:12:21

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

    l,k,i,j:longint;

    c:char;

    s:string;

    begin

    read(s); l:=0;k:=maxlongint;

    for i:=1 to length(s) do

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

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

    if a[c]>0 then

    begin

    if la[c] then k:=a[c];

    end;

    j:=l-k;

    if (j=0) or (j=1) then begin writeln('No Answer');write('0');halt;end;

    for i:=2 to j div 2 do

    if j mod i=0 then begin writeln('No Answer');write('0');halt;end;

    writeln('Lucky Word');write(j);

    end.

    参考,超容易懂的!!!

  • 0
    @ 2008-12-11 20:43:48

    lucky 第99个AC 我爱水题

    纯模拟就可以了 不过要注意最后输出时的一点小细节 还有0,1的情况 其他没什么了 初学者都能AC的好题

  • 0
    @ 2008-12-11 19:59:17

    for i:=1 to length(s) do begin

    k:=0;

    for j:=1 to length(s) do begin

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

    end;

    if min>k then min:=k;

    if max

  • 0
    @ 2008-12-11 18:52:36

    编译通过...

    ├ 测试数据 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-11 18:48:02

    秒杀!

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

    s:string;

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

    b:array[0..100] of boolean;

    c:array[0..100] of longint;

    begin

    readln(s);

    l:=length(s);

    for i:=1 to l do inc(a[ord(s[i])-96]);

    max:=0;min:=101;

    for i:=1 to 26 do begin

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

    if (a[i]

  • 0
    @ 2008-12-11 17:37:19

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    我考试的时候没考虑0不是质数..没拿满分...

    var st:string;

    i,max,min:integer;

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

    function zhi(i:integer):boolean;

    var x,j:integer;

    begin

    if i < 2 then exit(false);

    j:=0;

    for x:= 1 to i do

    if i mod x = 0 then inc(j);

    if j = 2 then exit(true);

    exit(false);

    end;

    begin

    readln(st);

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

    for i:= 1 to length(st) do

    inc(a[ord(st[i])-ord('a')+1]);

    max:=0;

    min:=32767;

    for i:= 1 to 24 do

    begin

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

    if ( a[i] > 0 ) and ( a[i] < min ) then min:=a[i];

    end;

    if zhi(max-min) then

    begin

    writeln('Lucky Word');

    writeln(max-min);

    end

    else

    begin

    writeln('No Answer');

    writeln('0');

    end;

    end.

  • 0
    @ 2008-12-11 17:12:05

    编译通过...

    ├ 测试数据 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-11 17:01:11

    样例有误:

    olympic -> olymipic

  • 0
    @ 2008-12-11 12:38:27

    谁能告诉我这道题怎么做?

  • 0
    @ 2008-12-11 12:13:11

    说实话,NOIP2008真水…………

  • 0
    @ 2008-12-11 09:49:11

    让OI留在2008。。。

    NOIP时唯一完全AC的题目``

  • 0
    @ 2008-12-11 08:03:04

    ^^^^^^^

  • -1
    @ 2017-07-19 16:18:52

    强势新手做法!!!

    
    
    ```cpp
    #include<iostream>
    #include<cstdlib>
    #include<cstdio>
    #include<map>
    #include<string>
    const int MAX=10000;
    using namespace std;
    int main() {
        char word[110]= {0};
        int hk=0;
        int a[30]= {0};
        int b=0,c=MAX;
        cin>>word;
        for(int st=0; st<=hk; st++) {
            if(word[st]!=0) {
                hk++;
            }
            if(word[st]=='a') {
                a[1]++;
            }
            if(word[st]=='b') {
                a[2]++;
            }
            if(word[st]=='c') {
                a[3]++;
            }
            if(word[st]=='d') {
                a[4]++;
            }
            if(word[st]=='e') {
                a[5]++;
            }
            if(word[st]=='f') {
                a[6]++;
            }
            if(word[st]=='g') {
                a[7]++;
            }
            if(word[st]=='h') {
                a[8]++;
            }
            if(word[st]=='i') {
                a[9]++;
            }
            if(word[st]=='j') {
                a[10]++;
            }
            if(word[st]=='k') {
                a[11]++;
            }
            if(word[st]=='l') {
                a[12]++;
            }
            if(word[st]=='m') {
                a[13]++;
            }
            if(word[st]=='n') {
                a[14]++;
            }
            if(word[st]=='o') {
                a[15]++;
            }
            if(word[st]=='p') {
                a[16]++;
            }
            if(word[st]=='q') {
                a[17]++;
            }
            if(word[st]=='r') {
                a[18]++;
            }
            if(word[st]=='s') {
                a[19]++;
            }
            if(word[st]=='t') {
                a[20]++;
            }
            if(word[st]=='u') {
                a[21]++;
            }
            if(word[st]=='v') {
                a[22]++;
            }
            if(word[st]=='w') {
                a[23]++;
            }
            if(word[st]=='x') {
                a[24]++;
            }
            if(word[st]=='y') {
                a[25]++;
            }
            if(word[st]=='z') {
                a[26]++;
            }
        }
        for(int i=1; i<=26; i++) {
            if(a[i]>b&&a[i]!=0) {
                b=a[i];
            }
            if(a[i]<c&&a[i]!=0) {
                c=a[i];
            }
        }
        int d=b-c;
        if(d==2||d==3||d==5||d==7||d==9||d==11||d==13||d==17||d==19||d==21||d==23||d==25||d==29||d==31||d==37||d==41||d==43||d==47||d==53||d==57||d==59||d==61||d==67||d==71||d==79||d==83||d==89||d==91||d==93||d==97)
            cout<<"Lucky Word"<<endl<<d;
        else
            cout<<"No Answer"<<endl<<0;
        return 0;
    }
    
  • -1
    @ 2017-01-09 09:45:06

    暴力
    ```c++
    #include<stdio.h>
    #include<string.h>
    char a[110];
    int much[30];
    int main()
    {
    int maxx=0,minn=100,len;
    scanf("%s",&a);
    len=strlen(a);
    for(int i=0;i<len;i++)
    {
    if(a[i]=='a') much[0]++;
    if(a[i]=='b') much[1]++;
    if(a[i]=='c') much[2]++;
    if(a[i]=='d') much[3]++;
    if(a[i]=='e') much[4]++;
    if(a[i]=='f') much[5]++;
    if(a[i]=='g') much[6]++;
    if(a[i]=='h') much[7]++;
    if(a[i]=='i') much[8]++;
    if(a[i]=='j') much[9]++;
    if(a[i]=='k') much[10]++;
    if(a[i]=='l') much[11]++;
    if(a[i]=='m') much[12]++;
    if(a[i]=='n') much[13]++;
    if(a[i]=='o') much[14]++;
    if(a[i]=='p') much[15]++;
    if(a[i]=='q') much[16]++;
    if(a[i]=='r') much[17]++;
    if(a[i]=='s') much[18]++;
    if(a[i]=='t') much[19]++;
    if(a[i]=='u') much[20]++;
    if(a[i]=='v') much[21]++;
    if(a[i]=='w') much[22]++;
    if(a[i]=='x') much[23]++;
    if(a[i]=='y') much[24]++;
    if(a[i]=='z') much[25]++;
    }
    for(int i=0;i<26;i++)
    {
    if(much[i]!=0&&much[i]<minn)
    {
    minn=much[i];
    }
    if(much[i]>maxx)
    {
    maxx=much[i];
    }
    }
    int prime=maxx-minn;
    if(prime==0||prime==1)
    {
    printf("No Answer\n0");
    }
    else
    {
    for(int i=2;i<=prime;i++)
    {

    if(i==prime)
    {

    printf("Lucky Word\n%d",prime);
    break;
    }
    if(prime%i==0)
    {
    printf("No Answer\n0");
    break;
    }
    }
    }
    return 0;
    }
    ```

信息

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