27 条题解

  • -1
    @ 2014-11-02 14:16:17
  • -1
    @ 2014-11-02 11:18:34

    第一个点T
    第二个点 W了
    咋回事啊?。
    #include<cstdio>
    inline int min(int a,int b){return a>b?b:a;}
    int main(){
    int n,i=1;
    scanf("%d\n",&n);
    while(n--){
    int G,O,D,M,N,I,R,K;
    G=O=D=M=N=I=R=K=0;
    char ch;
    while((ch=getchar())!='\n'){
    if(ch==' ')K++;
    if(ch=='g')G++;
    if(ch=='d')D++;
    if(ch=='o')O++;
    if(ch=='m')M++;
    if(ch=='n')N++;
    if(ch=='i')I++;
    if(ch=='r')R++;
    }
    G/=2;
    N/=2;
    O/=3;
    G=min(G,K);
    G=min(G,D);
    G=min(G,O);
    G=min(G,M);
    G=min(G,N);
    G=min(G,I);
    G=min(G,R);
    printf("Case #%d: %d\n",i,G);
    i++;
    }
    }

    • @ 2014-11-02 14:17:36

      第一个点. 我记得里面有空行(空行的答案当然是0)

  • -1
    @ 2014-11-02 10:52:34

    哪里错了???var a,b,c,e,min:longint;
    f:ansistring;
    g:array[1..8]of longint;
    d:array[1..20]of longint;
    begin
    readln(a);
    for b:=1 to a do
    begin
    readln(f);
    for c:=1 to length(f) do
    begin
    case f[c] of
    'g':inc(g[1]);
    'o':inc(g[2]);
    'd':inc(g[3]);
    'm':inc(g[4]);
    'r':inc(g[5]);
    'n':inc(g[6]);
    'i':inc(g[7]);
    ' ':inc(g[8]);
    end;
    end;
    g[1]:=g[1] div 2;
    g[2]:=g[2] div 3;
    g[6]:=g[6] div 2;
    min:=maxlongint;
    for c:=1 to 8 do
    if g[c]<min then min:=g[c];
    d[b]:=min;
    f:='';
    for c:=1 to 8 do g[c]:=0;
    end;
    for c:=1 to a do writeln('Case #',c,': ',d[c]);
    end.

    • @ 2014-11-02 11:00:20

      我和你的做法一样,不知道为什么不过?

  • -1
    @ 2014-11-02 10:45:07

    到底哪里错了????求大神指点??为什么运行错误???

    program wenhou;
    var
    a:array[0..50] of ansistring;
    t,i,j,z,k:longint;
    b:array[1..200] of longint;
    begin
    readln(t);
    for j:=1 to t do
    readln(a[j]);
    for j:=1 to t do
    begin
    for i:=1 to length(a[j]) do
    begin
    if a[j][i]='g' then b[1]:=b[1]+1;
    if a[j][i]='o' then b[2]:=b[2]+1;
    if a[j][i]='d' then b[3]:=b[3]+1;
    if a[j][i]=' ' then b[4]:=b[4]+1;
    if a[j][i]='m' then b[5]:=b[5]+1;
    if a[j][i]='r' then b[6]:=b[6]+1;
    if a[j][i]='n' then b[7]:=b[7]+1;
    if a[j][i]='i' then b[8]:=b[8]+1;
    end;
    b[1]:=b[1] div 2;
    b[2]:=b[2] div 3;
    b[7]:=b[7] div 2;

    k:=b[1];
    for i:=2 to 8 do if b[i]<k then k:=b[i];
    writeln('Case',' ','#',j,':',k);
    for i:=1 to 8 do b[i]:=0;
    end;
    end.

  • -1
    @ 2014-11-02 09:13:31

    80,T一个,W一个,为啥啊?
    #include <cstdio>
    #include <cstring>
    #include <string>
    #include <algorithm>
    using namespace std;
    const int maxn=1000+100;
    int num[100];
    string gm="g odmrni";//good morning
    char lie[maxn];
    int T;
    void read()
    {
    char x=getchar();
    int index=0;
    while(x!='\n')
    {
    lie[index++]=x;
    x=getchar();
    }
    }
    void work(int t)

    {
    memset(num,0,sizeof(num));
    for(int i=0;i<maxn;i++)
    {
    lie[i]='\0';
    }
    printf("Case #%d: ",t);
    read();
    int n=strlen(lie);
    for(int i=0;i<n;i++)
    {
    for(int j=0;j<8;j++)
    {
    if(lie[i]==gm[j])
    {
    num[j]++;
    break;
    }
    }
    }int ans=0x3f3f3f3f;
    for(int i=0;i<8;i++)//g odmrni good morning
    {
    if(i==0)num[i]/=2;
    else if(i==2)num[i]/=3;
    else if(i==6)num[i]/=2 ;
    ans=min(ans,num[i]);
    }printf("%d\n",ans);
    }
    void readdata()
    {
    scanf("%d\n",&T);
    for(int i=1;i<=T;i++)
    {
    work(i);
    }
    }
    int main()
    {
    readdata();
    return 0;
    }

  • -1
    @ 2014-11-01 18:47:19

    ...

  • -2
    @ 2015-08-03 15:54:39

    #include<cstdio>
    #include<iostream>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    int n;
    char c;
    string s;
    int a[10],ans;
    int main()
    {
    scanf("%d",&n);
    while((c=getchar())==' ');
    for(int k=1;k<=n;k++)
    {
    memset(a,0,sizeof(a));
    getline(cin,s);
    int l=s.size();
    for(int i=1;i<=l;i++)
    {
    if(s[i]==' ') a[1]++;
    if(s[i]=='g') a[2]++;
    if(s[i]=='o') a[3]++;
    if(s[i]=='d') a[4]++;
    if(s[i]=='m') a[5]++;
    if(s[i]=='r') a[6]++;
    if(s[i]=='n') a[7]++;
    if(s[i]=='i') a[8]++;
    }
    a[2]/=2;
    a[3]/=3;
    a[7]/=2;
    sort(a+1,a+9);
    ans=a[1];
    printf("Case #%d: %d\n",k,ans);
    }
    return 0;
    }

信息

ID
1902
难度
7
分类
(无)
标签
(无)
递交数
1573
已通过
341
通过率
22%
被复制
6
上传者