label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
2 | 600 | struct book
{char name[26];
int number;
}a[1000];
void main()
{
int n,i,j,b[26]={0},max=0,t;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i].number,a[i].name);
for(i=0;i<n;i++)
for(j=0;a[i].name[j]!='\0';j++)
b[a[i].name[j]-65]++;
for(i=0;i<26;i++)
if(max<b[i])
max=b[i];
for(i=0;i<26;i++)
if(max==b[i])
{
t=i;
break;
}
printf("%c\n%d\n",t+65,b[t]);
for(i=0;i<n;i++)
for(j=0;a[i].name[j]!='\0';j++)
if(a[i].name[j]==t+65)
{
printf("%d\n",a[i].number);
break;
}
}
|
2 | 601 |
struct book
{
int number;
char auther[27];
}bk[1000];
struct ath
{
char a;
int books[999];
int sum;
}auth[27],temp;
void main()
{
int n,i,x,m,j;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d%s",&bk[i].number,bk[i].auther);
for(i=0;i<27;i++)
{
for(j=0;j<999;j++)
auth[i].books[j]=0;
auth[i].sum=0;
auth[i].a='A'+i;
}
for(i=0;i<n;i++)
{
m=strlen(bk[i].auther);
int f;
for(f=0;f<m;f++)
{
x=(int)(bk[i].auther[f]-'A');
auth[x].books[auth[x].sum]=bk[i].number;
auth[x].sum++;
}
}
for(j=0;j<25;j++)
for(i=0;i<25-j;i++)
if(auth[i].sum>auth[i+1].sum)
{temp=auth[i];auth[i]=auth[i+1];auth[i+1]=temp;}
printf("%c\n",auth[25].a);
printf("%d\n",auth[25].sum);
i=0;
while(auth[25].books[i]!=0)
{printf("%d\n",auth[25].books[i]);i++;}
}
|
2 | 602 | /*
* 1.cpp
*
* Created on: 2013-1-13
* Author: Administrator
*/
int main()
{
int n, i, j, max = 0, maxi = 0;
int a[1100] = {0}, b[30] = {0}, c[30][1100] = {0};
char zz[1100][30];
cin >> n;
for(i = 1; i <= n; i++)
{
cin >> a[i] >> zz[i];
for(j = 0; zz[i][j] != '\0'; j++)
{
b[(int)zz[i][j] - 'A']++;
c[(int)zz[i][j] - 'A'][i] = 1;
}
}
for(i = 0; i <= 25; i++)
{
if(b[i] > max)
{
max = b[i];
maxi = i;
}
}
cout << (char)(maxi + 'A') << endl;
cout << max << endl;
for(i = 1; i <= 1000; i++)
{
if(c[maxi][i] == 1)
cout << a[i] << endl;
}
return 0;
}
|
2 | 603 |
struct book
{ int num;
char peo[26];
} book[999];
int main()
{ char zm,max;
int n,i,k,num,cishu=-1;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i].num,&book[i].peo);
}
for(zm='A';zm<='Z';zm++){
num=0;
for(i=0;i<n;i++){
for(k=0;k<26;k++){
if(book[i].peo[k]==zm)
num++;
}
}
if(num>cishu){
cishu=num;
max=zm;
}
}
printf("%c\n",max);
printf("%d\n",cishu);
for(i=0;i<n;i++){
for(k=0;k<26;k++){
if(book[i].peo[k]==max)
printf("%d\n",book[i].num);
}
}
return 0;
} |
2 | 604 | int main()
{
int n,i;
char wri[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int num[26];//?????????
char tem[100];
int j=0,k;
int shu[26][100];//?????
int hao;//??
for(i=0;i<26;i++)
num[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&hao,tem);
j=0;
while(tem[j]!='\0')
{
for(k=0;k<=25;k++)
{
if(wri[k]==tem[j])
{
shu[k][num[k]]=hao;
num[k]++;
}
}
j++;
}
}
int max=0;
for(i=1;i<26;i++)
{
if(num[i]>num[max])
max=i;
}
printf("%c\n%d\n",wri[max],num[max]);
for(i=0;i<num[max];i++)
printf("%d\n",shu[max][i]);
return 0;
}
|
2 | 605 | void main()
{
int n,i,j,card[1000],num[26]={0},max=0,k=0;
char s[1000][27];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&card[i],s[i]);
for(i=0;i<n;i++)
for(j=0;s[i][j]!='\0';j++)
num[s[i][j]-'A']++;
for(i=0;i<26;i++)
if(num[i]>max)
{max=num[i];k=i;}
printf("%c\n%d\n",k+'A',max);
for(i=0;i<n;i++)
for(j=0;s[i][j]!=0;j++)
if(s[i][j]==k+'A')
{printf("%d\n",card[i]);break;}
}
|
2 | 606 | struct book *head;
int abc[26];
struct book
{
int num;
char name[1000];
struct book *next;
};
void ffind(char * name)
{
while(*name!=0)
{
abc[*name-65]++;
name++;
}
}
int mfind(char * name,char a)
{
while(*name!=0)
{
if(a==*name)return 1;
name++;
}
}
struct book* creat (int max)
{
int n;
struct book *p1,*p2;
n=0;
p1=p2=(struct book*)malloc(LEN);
head=0;
do
{
scanf("%d %s",&p1->num,&p1->name);
ffind(p1->name);
n++;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p2->next=0;
p1=(struct book*)malloc(LEN);
}while(n<max);
p2->next=0;
return head;
}
void main()
{
int n,i;
int max=0,maxi=0;
char tt[2];
struct book *p,*p1;
scanf("%d",&n);
p=creat(n);
p1=p;
for(i=0;i<26;i++)
{
if(abc[i]>max)
{max=abc[i];
maxi=i;
}
}
printf("%C\n%d\n",65+maxi,max);
tt[0]=maxi+65;
tt[1]=0;
do{
if(mfind(p1->name,maxi+65)==1){
max--;
if(max!=0)
printf("%d\n",p1->num);
else printf("%d",p1->num);
}
p1=p1->next;
}while(p1!=0);
} |
2 | 607 |
int main()
{
int i, j, n;
struct book
{
int no;
char as[10];
} bk;
scanf("%d", &n);
struct book * books = (struct book *)malloc(sizeof(struct book) * n);
for (i = 0; i < n; i++)
{
scanf("%d %s", &bk.no, bk.as);
books[i] = bk;
}
int cnts[256] = {0};
for (i = 0; i < n; i++)
{
bk = books[i];
for (j = 0; bk.as[j]; j++)
{
cnts[bk.as[j]]++;
}
}
int count = 0;
for (int max = 1000; max > 0; max--)
{
for (char c = 'A'; c <= 'Z'; c++)
{
if (cnts[c] == max)
{
printf("%c\n%d\n", c, max);
for (i = 0; i < n; i++)
{
bk = books[i];
for (j = 0; bk.as[j]; j++)
{
if (bk.as[j] == c)
{
printf("%d\n", bk.no);
break;
}
}
}
count++;
}
}
if (count == 1)
{
free(books);
return 0;
}
}
free(books);
return -1;
}
|
2 | 608 | int trans(char k)
{
char a[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int i;
for(i=0;i<26;i++)
{
if(k==a[i])
return i;
}
}
int main ()
{
int m;
scanf("%d",&m);
struct point
{
int id;
char au[26];
}books[1000];
int num[26];
int i;
for(i=0;i<26;i++)
{
num[i]=0;
}
int j;
for(i=0;i<m;i++)
{
scanf("%d%s",&books[i].id,books[i].au);
}
for(i=0;i<m;i++)
{
int k;
k=strlen(books[i].au);
for(j=0;j<k;j++)
{ int b;
b=trans(books[i].au[j]);
num[b]++;
}
}
int max=0;
int most;
for(i=0;i<26;i++)
{
if(num[i]>max)
{
max=num[i];
most=i;
}
}
char aumost;
aumost='A'+most;
printf("%c\n",aumost);
printf("%d\n",max);
for(i=0;i<m;i++)
{
int k;
k=strlen(books[i].au);
for(j=0;j<k;j++)
{
if(books[i].au[j]=='A'+most)
{
printf("%d\n",books[i].id);
break;
}
}
}
return 0;
}
|
2 | 609 | void main()
{
struct s
{
int a;
char b[100];
struct s *next;
};
struct s *p1,*p2,*head;
int m,n,i,j,k,t,d[50],max;
char c;
scanf("%d",&n);
p1=(struct s *)malloc(sizeof(struct s));
p2=p1;
head=p1;
scanf("%d %s",&p1->a,p1->b);
for(i=0;i<n-1;i++)
{
p1=(struct s *)malloc(sizeof(struct s));
p2->next=p1;
p2=p1;
scanf("%d %s",&p1->a,p1->b);
}
p2->next=0;
t=0;
p1=p2=head;
for(c='A';c<='Z';c++)
{
k=0;
for(i=0;i<n;i++)
{
j=0;
while(p1->b[j]!='\0')
{
if(c==p1->b[j])
k++;
j++;
}
p1=p1->next;
}
d[t]=k;
t++;
p1=head;
}
j=0;
max=d[0];
for(i=1;i<26;i++)
if(d[i]>max)
{
max=d[i];
j=i;
}
printf("%c\n",'A'+j);
printf("%d\n",max);
t='A'+j;
for(i=0;i<n;i++)
{
j=0;
while(p1->b[j]!='\0')
{
if(t==p1->b[j])
printf("%d\n",p1->a);
j++;
}
p1=p1->next;
}
} |
2 | 610 | void main()
{
int m,n,i,j,k,d,s;
int a,b=0,c;
int tt[1000],pp[1000],miao[26]={0};
char kk[1000][30];
char w;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&tt[i],kk[i]);
}
for(s=0,j=65;j<=90;j++,s++)
{
for(k=0;k<m;k++)
{
for(d=0;kk[k][d]!='\0';d++)
{
if(kk[k][d]==j) miao[s]++;
}
}
}
for(a=0;a<26;a++)
{
if(miao[a]>b) {b=miao[a];c=a;}
}
printf("%c\n%d\n",c+65,b);
w=(c+65);
for(i=0;i<m;i++)
{
for(j=0;kk[i][j]!='\0';j++)
{
if(kk[i][j]==w) {printf("%d\n",tt[i]);break;}
}
}
} |
2 | 611 |
struct book
{
int num;
char author[27];
}book[1000];
int main()
{
int n, i, a, max=0, alp[26]={0};
char *j;
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%d %s", &book[i].num, book[i].author);
int len=strlen(book[i].author);
for(j=book[i].author;j<(book[i].author+len);j++)
{
int x=*j;
++*(alp+x-65);
if(*(alp+x-65)>max)
{
max=*(alp+x-65);
a=x;
}
}
}
printf("%c\n%d\n", a, max);
for(i=0;i<n;i++)
{
int len=strlen(book[i].author);
for(j=book[i].author;j<(book[i].author+len);j++)
{
if((int)*j==a)
printf("%d\n", book[i].num);
}
}
return 0;
}
|
2 | 612 | struct Au{
int num;
int a[1000];
} au[26];
int main ()
{
int i, n, buch, tn;
char s[30];
for(i=0; i<26; i++)
au[i].num=0;
scanf("%d", &n);
while(n--) {
scanf("%d%s", &buch, s);
for (i=0; s[i]; i++) {
tn=au[s[i]-'A'].num;
au[s[i]-'A'].a[tn]=buch;
au[s[i]-'A'].num++;
}
}
int temp=0;
for (i=1; i<26; i++)
if (au[i].num>au[temp].num)
temp=i;
printf("%c\n%d\n", 'A'+temp, au[temp].num);
for (i=0; i<au[temp].num; i++)
printf("%d\n", au[temp].a[i]);
return 0;
}
|
2 | 613 | void main()
{
int num[1000],i,j,a[26]={0},len,k,max,l=0;
char x[1000][10];
int n;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&num[i],x[i]);
for(i=0;i<n;i++)
{
len=0;
k=0;
len=strlen(x[i]);
for(j=0;j<len;j++)
{
k=x[i][j];
a[k-65]++;
}
}
max=a[0];
for(j=1;j<26;j++)
{
if(a[j]>max)
{
max=a[j];
l=j;
}
}
printf("%c\n",l+65);
printf("%d\n",max);
for(i=0;i<n;i++)
{
for(j=0;j<10;j++)
{
if(x[i][j]==(l+65)) printf("%d\n",num[i]);
}
}
} |
2 | 614 | void main()
{
int n,i,j;
int max,p;
int mwj;
int shu[1000];
char zuo[1000][30];
int w[26];
for(i=0;i<26;i++)
w[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&shu[i],zuo[i]);
for(j=0;j<strlen(zuo[i]);j++)
{
w[(zuo[i][j]-65)]=w[(zuo[i][j]-65)]+1;
}
}
max=w[0];p=0;
for(i=0;i<26;i++)
{
if(w[i]>max)
{
max=w[i];
p=i;
}
}
printf("%c\n",p+65);
printf("%d\n",max);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(zuo[i]);j++)
{
mwj=zuo[i][j];
if(mwj==p+65)
{
printf("%d\n",shu[i]);
break;
}
}
}
}
|
2 | 615 | struct inf
{
int sum;
char write[1000][4];
};
int main()
{
int m;
int i,j;
char name[5];
char author[27];
struct inf book[26];
for(i=0;i<26;i++)
book[i].sum=0;
cin >> m ;
cin.get();
while( m -->0 )
{
cin.get( name,5);
cin.getline( author,27);
for(i=0;i <strlen(author);i++)
{
book[author[i]-'A'].sum++;
for( j=0;j<=3;j++)
{
if(j<3)
book[author[i]-'A'].write[book[author[i]-'A'].sum][j] = name[j];
else
book[author[i]-'A'].write[book[author[i]-'A'].sum][j]='\0';
}
}
}
int max=0,t;
for(i=0;i<26;i++)
{
if(book[i].sum>max)
{
t=i;
max = book[i].sum;
}
}
cout << (char)(t+'A') << endl << book[t].sum << endl;
for( i=1;i<=book[t].sum;i++)
cout << book[t].write[i] << endl;
return 0;
}
|
2 | 616 | main()
{
int i,j,m,a[26]={0},max=0;
struct book
{
int no;
char w[26];
}
s[1000];
scanf("%d",&m);
for (i=0;i<m;i++)
{
scanf("%d %s",&s[i].no,s[i].w);
for (j=0;j<strlen(s[i].w);j++)
a[s[i].w[j]-'A']++;
}
for (i=0;i<26;i++)
if (a[i]>a[max])
max=i;
printf("%c\n%d\n",max+'A',a[max]);
for (i=0;i<m;i++)
for (j=0;j<strlen(s[i].w);j++)
if (s[i].w[j]==max+'A')
printf("%d\n",s[i].no);
}
|
2 | 617 | void main()
{
int n,a[1000],i,b[26]={0},m,j,max=0,k;
char str[1000][30];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&a[i],str[i]);
}
for(i=0;i<n;i++)
{
m=strlen(str[i]);
for(j=0;j<m;j++)
{
if(str[i][j]=='A')
b[0]++;
if(str[i][j]=='B')
b[1]++;
if(str[i][j]=='C')
b[2]++;
if(str[i][j]=='D')
b[3]++;
if(str[i][j]=='E')
b[4]++;
if(str[i][j]=='F')
b[5]++;
if(str[i][j]=='G')
b[6]++;
if(str[i][j]=='H')
b[7]++;
if(str[i][j]=='I')
b[8]++;
if(str[i][j]=='J')
b[9]++;
if(str[i][j]=='K')
b[10]++;
if(str[i][j]=='L')
b[11]++;
if(str[i][j]=='M')
b[12]++;
if(str[i][j]=='N')
b[13]++;
if(str[i][j]=='O')
b[14]++;
if(str[i][j]=='P')
b[15]++;
if(str[i][j]=='Q')
b[16]++;
if(str[i][j]=='R')
b[17]++;
if(str[i][j]=='S')
b[18]++;
if(str[i][j]=='T')
b[19]++;
if(str[i][j]=='U')
b[20]++;
if(str[i][j]=='V')
b[21]++;
if(str[i][j]=='W')
b[22]++;
if(str[i][j]=='X')
b[23]++;
if(str[i][j]=='Y')
b[24]++;
if(str[i][j]=='Z')
b[25]++;
}
}
for(i=0;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
k=i;
}
}
printf("%c\n%d\n",k+65,max);
for(i=0;i<n;i++)
{
m=strlen(str[i]);
for(j=0;j<m;j++)
{
if(str[i][j]==k+65)
printf("%d\n",a[i]);
}
}
}
|
2 | 618 | int main()
{
int num[27] = {0},no[27][1000]={0};
char s[27],ls;
int l,i,max,t,j,flag,n,w;
cin >> t;
for (i = 1;i <= t;i++)
{
cin >> n >> s;
l = strlen (s);
for (j = 0;j <= l-1;j++)
{
w = s[j] - 'A' + 1;
num[w] ++;
no[w][num[w]] = n;
}
}
max = 0;
for (i = 1;i <= 26;i++)
if (num[i] > max)
{
max = num[i];
flag = i;
}
ls = (char) 64+flag;
cout << ls << endl << num[flag] << endl;
for (i = 1;i <= num[flag];i++)
cout << no[flag][i] << endl;
cin >> w;
return 0;
} |
2 | 619 |
struct book
{
int num;
char writer[100];
};
void main()
{
int n,i,j,a[26],c[100],k,t,d[100],s;
struct book bo[100];
for(i=0;i<26;i++)
a[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&bo[i].num);
scanf("%s",bo[i].writer);
}
for(i=0;i<n;i++)
{
c[i]=strlen(bo[i].writer);
for(j=0;j<c[i];j++)
{
k=bo[i].writer[j]-'A';
a[k]++;
}
}
t=a[0];
j=0;
for(i=1;i<26;i++)
{
if(a[i]>t)
{
j=i;
t=a[i];
}
}
s=j;
printf("%c\n",'A'+j);
printf("%d\n",t);
for(i=0;i<n;i++)
{
d[i]=0;
for(j=0;j<c[i];j++)
{
if(bo[i].writer[j]==('A'+s))
d[i]=1;
}
if(d[i]==1)
printf("%d\n",bo[i].num);
}
}
|
2 | 620 | int main()
{
int m,a[1000],i,n,j,k;
scanf("%d",&m);
char b[1000][27];
int count[26]={0};
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i],b[i]);
}
for(i=0;i<m;i++)
{
n=strlen(b[i]);
for(j=0;j<n;j++)
{
for(k=0;k<26;k++)
{
if(b[i][j]==k+65)count[k]++;
}
}
}
int max,maxk;
max=count[0];
maxk=0;
for(k=0;k<26;k++)
{
if(count[k]>max)
{
max=count[k];
maxk=k;
}
}
char mauthor;
mauthor=maxk+65;
printf("%c\n%d\n",mauthor,max);
for(i=0;i<m;i++)
{
n=strlen(b[i]);
for(j=0;j<n;j++)
{
if(b[i][j]==mauthor)
{
printf("%d\n",a[i]);
break;
}
}
}
return 0;
}
|
2 | 621 | void main()
{
struct book
{
char num[100],wri[26];
} bo[1000];
int i,j,k,l,n,m=0,a[26]={0},mw;
scanf("%d\n",&n);
for (i=0;i<n;i++)
{
scanf("%s %s",bo[i].num,bo[i].wri);
l=strlen(bo[i].wri);
for (j=0;j<l;j++) a[bo[i].wri[j]-65]++;
}
for (i=0;i<26;i++) if(a[i]>m) {m=a[i];mw=65+i;}
printf("%c\n%d\n",mw,m);
for (i=0;i<n;i++)
{
l=strlen(bo[i].wri);
for (j=0;j<l;j++) if(bo[i].wri[j]==mw) {puts(bo[i].num);break;}
}
} |
2 | 622 | struct index
{
int num;
char wr[26];
};
int main()
{
int n,a[26],*pr,max;
char s[26],*sp,*pt,temp;
for(pr=a;pr<a+26;pr++)
{
*pr=0;
}
sp=s;
*sp=65;
for(sp=s+1;sp<s+26;sp++)
{
*sp=*(sp-1)+1;
}
struct index *p;
scanf("%d",&n);
struct index *ind=(struct index*)malloc(sizeof(struct index)*n);
for(p=ind;p<ind+n;p++)
{
scanf("%d %s",&p->num,p->wr);
}
for(p=ind;p<ind+n;p++)
{
for(pt=(*p).wr;pt<(*p).wr+26;pt++)
{
for(pr=a,sp=s;sp<s+26;sp++,pr++)
{
if(*pt==*sp)
{
(*pr)++;
}
}
}
}
max=*a;
temp=65;
for(pr=a,sp=s;pr<a+26;pr++,sp++)
{
if(*pr>max)
{
max=*pr;
temp=*sp;
}
}
for(pr=a,sp=s;sp<s+26;sp++,pr++)
{
if(*pr==max)
{
printf("%c\n%d\n",*sp,*pr);
}
}
for(p=ind;p<ind+n;p++)
{
for(pt=(*p).wr;pt<(*p).wr+26;pt++)
{
if(*pt==temp)
{
printf("%d\n",(*p).num);
}
}
}
free(ind);
return 0;
} |
2 | 623 | struct info
{
short int num;
char author[27];
};
int main()
{
char findoutmax(struct info a[],int n,int *pt);
void detect(struct info b[],char writter,int nn);
char figure;
int i,n_book,max,*p;
struct info book[999];
scanf("%d",&n_book);
for (i=0;i<n_book;i++)
{
scanf("%d %s",&book[i].num , &book[i].author);
}
p=&max;
figure=findoutmax(book,n_book,p);
printf("%c\n%d\n",figure,max);
detect(book,figure,n_book);
return 0;
}
char findoutmax(struct info a[],int n,int *pt)
{
int i,j,sum[26]={0};
for (i=0;i<n;i++)
{
for (j=0;a[i].author[j]!='\0';j++)
{
switch (a[i].author[j])
{
case 'A': sum[0]=sum[0]+1; break;
case 'B': sum[1]=sum[1]+1; break;
case 'C': sum[2]=sum[2]+1; break;
case 'D': sum[3]=sum[3]+1; break;
case 'E': sum[4]=sum[4]+1; break;
case 'F': sum[5]=sum[5]+1; break;
case 'G': sum[6]=sum[6]+1; break;
case 'H': sum[7]=sum[7]+1; break;
case 'I': sum[8]=sum[8]+1; break;
case 'J': sum[9]=sum[9]+1; break;
case 'K': sum[10]=sum[10]+1; break;
case 'L': sum[11]=sum[11]+1; break;
case 'M': sum[12]=sum[12]+1; break;
case 'N': sum[13]=sum[13]+1; break;
case 'O': sum[14]=sum[14]+1; break;
case 'P': sum[15]=sum[15]+1; break;
case 'Q': sum[16]=sum[16]+1; break;
case 'R': sum[17]=sum[17]+1; break;
case 'S': sum[18]=sum[18]+1; break;
case 'T': sum[19]=sum[19]+1; break;
case 'U': sum[20]=sum[20]+1; break;
case 'V': sum[21]=sum[21]+1; break;
case 'W': sum[22]=sum[22]+1; break;
case 'X': sum[23]=sum[23]+1; break;
case 'Y': sum[24]=sum[24]+1; break;
case 'Z': sum[25]=sum[25]+1; break;
}
}
}
j=0;
for (i=1;i<26;i++)
{
if (sum[j]<sum[i]) j=i;
}
*pt=sum[j];
return (65+j);
}
void detect(struct info b[],char writter,int nn)
{
int i,j;
for (i=0;i<nn;i++)
{
for (j=0;b[i].author[j]!='\0';j++)
{
if (b[i].author[j]==writter)
{
printf("%d\n",b[i].num);
}
}
}
}
|
2 | 624 | void main()
{
int len[1000];
int b[26];
int a[1000];
char str[1000][26];
int m,i,j,max,num;
char c;
int pos,temp;
scanf("%d",&m);
for(i=0;i<26;i++)
b[i]=0;
for(i=0;i<m;i++)
{
scanf("%d ",&a[i]);
scanf("%s",str[i]);
len[i]=strlen(str[i]);
for(j=0;j<len[i];j++)
{
temp=str[i][j]-'A';
b[temp]++;
}
}
max=b[0];
pos=0;
for(i=1;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
pos=i;
}
}
c=pos+'A';
printf("%c\n",c);
printf("%d\n",max);
num=0;
for(i=0;i<m;i++)
for(j=0;j<len[i];j++)
if(str[i][j]==c)
{
num++;
if(num<max)
printf("%d\n",a[i]);
else printf("%d",a[i]);
}
} |
2 | 625 |
int main() {
struct book1 {
int num;
char author[20];
} book[999];
int time[26]={0};
int n, i, j, k, maxi, sign=0;
scanf("%d", &n);
for (i=0;i<n;i++) {
scanf("%d%s", &book[i].num, book[i].author);
}
for (i=0;i<n;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
for (k=0;k<26;k++) {
if (book[i].author[j]=='A'+k) {
time[k]+=1;
break;
}
}
}
}
maxi=0;
for(i=0;i<26;i++) {
if (time[maxi]<time[i]) {
maxi=i;
}
}
printf("%c\n%d\n", 'A'+maxi, time[maxi]);
for (i=0;i<n&&sign==0;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
if (book[i].author[j]=='A'+maxi) {
printf("\n%d", book[i].num);
sign=1;
break;
}
}
}
for (;i<n;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
if (book[i].author[j]=='A'+maxi) {
printf("\n%d", book[i].num);
break;
}
}
}
return 0;
} |
2 | 626 | int main()
{
struct tushu
{
int bianhao;
char zuozhe[26];
};
int i,j,n,q=0;
int count[26]={0};
scanf("%d",&n);
struct tushu *pp;
pp=(struct tushu *)malloc(sizeof(tushu)*n);
int *m;
m=(int *)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
{
scanf("%d %s",&((pp+i)->bianhao),(pp+i)->zuozhe);
}
for(i=0;i<n;i++)
{
m[i]=strlen(pp[i].zuozhe);
for(j=0;j<m[i];j++)
{
count[pp[i].zuozhe[j]-'A']++;
}
}
int max=0;
for(i=0;i<26;i++)
{
if(count[i]>max){max=count[i];q=i;}
}
printf("%c\n%d\n",'A'+q,max);
for(i=0;i<n;i++)
{
for(j=0;j<m[i];j++)
{
if(pp[i].zuozhe[j]==('A'+q))printf("%d\n",pp[i].bianhao);
}
}
return 0;
}
|
2 | 627 | struct book
{
int ISBN;
char name[26];
}b[999];
int main()
{
int i,j,m,k[26],max=0;
char a,d='A';
for(i=0;i<26;i++)
k[i]=0;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&b[i].ISBN,b[i].name);
for(a='A';a<='Z';a++)
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(b[i].name[j]==a)
k[a-'A']++;
for(i=0;i<26;i++)
if(k[i]>=max)
max=k[i];
for(i=0;i<26;i++)
if(k[i]==max)
{
d+=i;
printf("%c\n",d);
printf("%d\n",max);
}
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(b[i].name[j]==d)
printf("%d\n",b[i].ISBN);
return 0;
} |
2 | 628 | struct SHU
{
int bh;
char bz[26];
};
int main()
{
int m,i,j,l,k,p;
int name[200]={0},max,shuhao[1000];
struct SHU shu[1000];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&shu[i].bh,shu[i].bz);
}
for(i=0;i<m;i++)
{
l=strlen(shu[i].bz);
for(j=0;j<l;j++)
{
name[shu[i].bz[j]]++;
}
}
max=name[0];
for(i=0;i<200;i++)
{
if(name[i]>max)
{
max=name[i];
k=i;
}
}
p=0;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(shu[i].bz[j]==k)
{
shuhao[p]=shu[i].bh;
p++;
}
}
}
printf("%c\n",k);
printf("%d\n",max);
for(i=0;i<p;i++)
{
printf("%d\n",shuhao[i]);
}
return 0;
}
|
2 | 629 |
struct student
{int num;
char s[26];
}stu[999];
int main()
{ int m,a[26]={0},i,j,max,k,l=0;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&stu[i].num,stu[i].s);
for(i=0;i<26;i++)
for(k=0;k<m;k++)
for(j=0;j<strlen(stu[k].s);j++)
if(stu[k].s[j]=='A'+i)
a[i]++;
max=a[0];
for(i=1;i<26;i++)
if(a[i]>max)
{ max=a[i];l=i;}
printf("%c\n",'A'+l);
printf("%d\n",max);
for(i=0;i<m;i++)
for(j=0;j<strlen(stu[i].s);j++)
if(stu[i].s[j]=='A'+l)
{ printf("%d\n",stu[i].num);
break;}
return 0;
}
|
2 | 630 |
int main()
{
int n ;
cin >> n ;
int shu ;
char ppl[27] ;
int a[26][n+1] ;
memset( a , 0 , sizeof( a ) ) ;//???
for( int i = 0 ; i < n ; i ++ )
{
memset( ppl , 0 , sizeof( ppl ) ) ;//????
cin >> shu ;//????
getchar() ;//???
cin.getline( ppl , 27 ,'\n' ) ;//????
for( int j = 0 ; 'A' <= ppl[j] && ppl[j] <= 'Z' ; j ++ )
{
a[ (int) ppl[j] - ( int ) 'A' ][0] ++ ;//0????
a[ (int) ppl[j] - ( int ) 'A' ][ a[ (int) ppl[j] - ( int ) 'A' ][0] ] = shu ;//??????
}
}
int max = 0 , set = 0 ;//??????
for( int i = 0 ; i < 26 ; i ++ )
{
if( a[i][0] > max )
{
max = a[i][0] ;
set = i ;
}
}
cout << ( char ) ( ( int )'A' + set ) << endl ;//???????
cout << max << endl ;
for( int i = 1 ; i <= max ; i ++ )
cout << a[set][i] << endl ;
return 0 ;
} |
2 | 631 | void main()
{
int n,len,i,j,k,max;
int c[26]={0};
char a[26],f,x;
struct book{ int num; char author[26];};
struct book b[1000];
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%d %s",&b[i].num,&b[i].author);
for(i=0;i<n;i++)
{
strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if('A'<=(x=a[j])&&(x=a[j])<='Z')
c[x-'A']++;
}
max=c[0];k=0;
for(i=0;i<26;i++)
{if(c[i]>max)
{max=c[i];
k=i;
}}
printf("%c\n%d\n",k+'A',max);
for(i=0;i<n;i++)
{
strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if((f=a[j])==k+'A')
printf("%d\n",b[i].num);
}
} |
2 | 632 | struct st
{
int a;
char s[26];
struct st *n;
}
;
struct st *creat(int m)
{
int i;
struct st *p1,*p2,*head;
for(i=0;i<m;i++)
{
p1=(struct st *)malloc(len);
if(i==0)head=p1;
else p2->n=p1;
scanf("%d %s",&p1->a,p1->s);
p2=p1;
}
p1->n=NULL;
return(head);
}
void main()
{
int m;
struct st *creat(int m);
scanf("%d",&m);
struct st *p,*q;
p=creat(m);
q=p;
int i,j,k;
int a[26]={0};
for(i=0;i<m;i++)
{
for(j=0;j<(k=strlen(p->s));j++)a[p->s[j]-65]++;
p=p->n;
}
p=q;
int max=a[0];
for(i=1;i<26;i++)
{
if(a[i]>max)max=a[i];
}
char c;
for(i=0;i<26;i++)
{
if(a[i]==max)
{
c=i+65;
printf("%c\n%d\n",c,a[i]);
break;
}
}
char cc;
for(i=0;i<m;i++)
{
for(j=0;;j++)
{
cc=q->s[j];
if(cc=='\0')break;
if(c==cc)printf("%d\n",q->a);
}
q=q->n;
}
} |
2 | 633 | struct book
{
int no;
char auth[26];
};
void main()
{
struct book *head,*BK;
int m,n,k,i,j,t,q,p,max;
int a[26]={0};
scanf("%d",&m);
BK=(struct book*)malloc(m*LEN);
head=BK;
for(i=0;i<m;i++)
{
scanf("%d %s",&BK->no,&BK->auth);
n=strlen(BK->auth);
for(j=0;j<n;j++)
{
k=BK->auth[j]-'A';
a[k]=a[k]+1;
}
BK=BK+1;
}
max=a[0];
t=0;
for(i=1;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
t=i;
}
}
q=t+'A';
printf("%c\n%d\n",q,max);
BK=head;
for(i=0;i<m;i++)
{
p=0;
n=strlen(BK->auth);
for(j=0;j<n;j++)
{
if(BK->auth[j]==q)
{
p=1;
break;
}
}
if(p==1)
{
printf("%d\n",BK->no);
}
BK=BK+1;
}
} |
2 | 634 | int main ()
{
int n,i,a[1000],m[1000];
struct {
char b[26];
}p[1000];
int j,k;
scanf("%d",&n);
char c[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int num[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
for (i=0;i<n;i++)
{
scanf("%d %s",&a[i],p[i].b);
m[i]=strlen(p[i].b);
for (k=0;k<26;k++)
for (j=0;j<m[i];j++)
{
if (p[i].b[j]==c[k])
num[k]++;
}
}
int max=0,local=0;
for (k=0;k<26;k++)
{
if (num[k]>max)
{
max=num[k];
local=k;
}
}
printf("%c\n",c[local]);
printf("%d\n",max);
for (i=0;i<n;i++)
{
for (j=0;j<m[i];j++)
{
if (p[i].b[j]==c[local])
printf("%d\n",a[i]);
}
}
return 0;
} |
2 | 635 | int main()
{
int k;
cin>>k;
int book;
char writer[26];
int counter[26]={0};
int bookbelong[26][999]={0};
int everynum[26]={0};
int t=0;
while(k--)
{
cin>>book>>writer;
int str=strlen(writer);
for(int i=0;i<str;i++)
{
int flag=writer[i]-'A';
counter[flag]++;
bookbelong[flag][everynum[flag]++]=book;
}
}
int max=counter[0];
int maxnum=0;
for(int i=0;i<26;i++)
{
if(counter[i]>max)
{
maxnum=i;
max=counter[i];
}}
char writerbest;
writerbest='A'+maxnum;
cout<<writerbest<<endl<<everynum[maxnum]<<endl;
for(int i=0;i<everynum[maxnum];i++)
cout<< bookbelong[maxnum][i]<<endl;
return 0;
}
|
2 | 636 | void main()
{
char book[1000][30];
int n,i,j,k,r,len[1000],a[26][1000]={0},b[26]={0},max,s,c[26];
scanf("%d",&n);
for(i=0;i<=n;i++)
{
gets(book[i]);
scanf("\n");
}
for(i=0;i<=n;i++)
for(j=0;book[i][j]!=' ';j++)
len[i]=j;
for(k=0;k<26;k++)
{
r=0;
for(i=0;i<=n;i++)
{
for(j=len[i]+1;j<strlen(book[i]);j++)
{
if(book[i][j]==k+65)
{
b[k]++;
a[k][r]=i;
r++;
}
}
}
c[k]=r;
}
max=b[0];
for(i=1;i<26;i++)
{
if(b[i]>=max)
{
max=b[i];
s=i;
}
}
printf("%c\n",s+65);
printf("%d\n",max);
for(i=0;i<c[s];i++)
{
for(j=0;j<=len[a[s][i]];j++)
printf("%c",book[a[s][i]][j]);
printf("\n");
}
}
|
2 | 637 |
struct record
{
int id;
};
struct YyxNode
{
struct record m_rec;
struct YyxNode *next;
};
struct YyxLink
{
int n;
struct YyxNode *head;
struct YyxNode *tail;
};
struct YyxLink *CreateNewLink()
{
struct YyxLink *newLn;
struct YyxNode *newNd;
if(((newLn=(struct YyxLink*)malloc(sizeof(struct YyxLink)))==NULL)
||((newNd=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL)){
printf("Error: memory out! (1)");
exit(-1);
}
newLn->n = 0;
newLn->head = newNd;
newNd->next = NULL;
newLn->tail = newNd;
return newLn;
}
struct YyxLink *AddNode(struct YyxLink *ln, const struct record *rec)
{
struct YyxNode *newNd;
if((newNd=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL){
printf("Error: memory out! (2)");
exit(-1);
}
newNd->m_rec = *rec;
newNd->next = NULL;
ln->tail->next = newNd;
ln->tail = newNd;
ln->n ++;
return ln;
}
struct YyxLink *ClearLink(struct YyxLink *ln)
{
struct YyxNode *delNd, *nextNd;
delNd = ln->head->next;
for(; delNd!=NULL; delNd=nextNd){
nextNd = delNd->next;
free(delNd);
}
ln->n = 0;
ln->head->next = NULL;
return ln;
}
void FreeLink(struct YyxLink *ln)
{
ClearLink(ln);
free(ln->head);
free(ln);
}
int main()
{
struct YyxLink **total;
int m;
struct record rec;
char author[27];
int i;
char *pch;
struct YyxNode *nd;
if((total=(struct YyxLink**)malloc(26*sizeof(struct YyxLink*)))==NULL){
printf("Error: memory out! (3)\n");
exit(-1);
}
for(i=0; i<26; i++){
total[i] = CreateNewLink();
}
scanf("%d", &m);
for(; m>0; m--){
scanf("%d %s", &rec.id, author);
pch = author;
for(; *pch!='\0'; pch++){
AddNode(total[*pch-'A'], &rec);
}
}
m = 0;
for(i=1; i<26; i++){
if(total[m]->n<total[i]->n)
m = i;
}
printf("%c\n%d\n", m+'A', total[m]->n);
nd = total[m]->head->next;
for(; nd!=NULL; nd=nd->next){
printf("%d\n", nd->m_rec);
}
return 0;
} |
2 | 638 | void main()
{
struct book
{
int a;
char b[20];
}book[999];
int n,i,k,max,m,j,p;
int c[999]={0};
char str1[20],str2[20];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i].a,&book[i].b);
m=strlen(book[i].b);
strcpy(str1,book[i].b);
for(j=0;j<m;j++)
c[str1[j]]= c[str1[j]]+1;
}
max=0;
for(p=65;p<91;p++)
{
if(c[p]>max)
{max=c[p];
k=p;}
}
printf("%c\n",k);
printf("%d\n",max);
for(i=0;i<n;i++)
{
strcpy(str2,book[i].b);
m=strlen(book[i].b);
for(j=0;j<m;j++)
{if(str2[j]==k)
printf("%d\n",book[i].a);}
}
}
|
2 | 639 | int c[26];
char b[1000][100];
char out;
int main(int argc, char* argv[])
{
int n,i,j,tmp=0,tmp1=0,tmp2;
int a[1000];
out='A';
scanf ("%d",&n);
for (i=0;i<n;i++)
{
scanf ("%d %s",&a[i],b[i]);
for (j=0;j<strlen(b[i]);j++)
{
if (b[i][j]=='A') c[0]++;if (b[i][j]=='B') c[1]++;if (b[i][j]=='C') c[2]++;if (b[i][j]=='D') c[3]++;
if (b[i][j]=='E') c[4]++;if (b[i][j]=='F') c[5]++;if (b[i][j]=='G') c[6]++;if (b[i][j]=='H') c[7]++;
if (b[i][j]=='I') c[8]++;if (b[i][j]=='J') c[9]++;if (b[i][j]=='K') c[10]++;if (b[i][j]=='L') c[11]++;
if (b[i][j]=='M') c[12]++;if (b[i][j]=='N') c[13]++;if (b[i][j]=='O') c[14]++;if (b[i][j]=='P') c[15]++;
if (b[i][j]=='Q') c[16]++;if (b[i][j]=='R') c[17]++;if (b[i][j]=='S') c[18]++;if (b[i][j]=='T') c[19]++;
if (b[i][j]=='U') c[20]++;if (b[i][j]=='V') c[21]++;if (b[i][j]=='W') c[22]++;if (b[i][j]=='X') c[23]++;
if (b[i][j]=='Y') c[24]++;if (b[i][j]=='Z') c[25]++;
}
}
for (i=0;i<26;i++)
{
if (c[i]>tmp)
{
tmp=c[i];
tmp1=i;
}
}
printf ("%c\n%d\n",out+tmp1,tmp);
for (i=0;i<n;i++)
{
for (j=0;b[i][j]!='\0';j++)
{
tmp2=b[i][j];
if (tmp2==(out+tmp1))
{
printf("%d\n",a[i]);
break;
}
}
}
return 0;
} |
2 | 640 |
int main()
{
int m;
int book[1020];
scanf("%d",&m);
int i;
char c;
int a[27]={0};
int b[27][1000]={0};
for(i=1;i<=m;i++)
{
scanf("%d",&book[i]);
getchar();
for(;;)
{
scanf("%c",&c);
if(c=='\n') break;
a[c-64]+=1;
b[c-64][i]=1;
}
}
int max=0,p;
for(i=1;i<27;i++)
{
if(a[i]>max)
{
max=a[i];
p=i;
}
}
printf("%c\n%d\n",p+64,max);
for(i=0;i<1000;i++)
{
if(b[p][i]==1) printf("%d\n",book[i]);
}
return 0;
} |
2 | 641 | int main()
{
int m,i,a[1000]={0},count[30]={0},temp,j,max=-999,flag;
char s[1000][30]={0},cha;
scanf("%d", &m);
for(i=1;i<=m;i++)
{
scanf("%d", &a[i]);
for(j=1;j<30;j++)
{
scanf("%c", &s[i][j]);
if(s[i][j]==' ')
{
s[i][j]=0;
continue;
}
if(s[i][j]=='\n')
{
s[i][j]=0;
break;
}
temp=s[i][j]-'A'+1;
count[temp]+=1;
}
}
for(i=1;i<=26;i++)
{
if(count[i]>=max)
{
flag=i;
max=count[i];
}
}
printf("%c\n%d\n", flag+64,max);
cha='A'+flag-1;
for(i=1;i<=m;i++)
{
for(j=1;j<30;j++)
{
if(s[i][j]==cha)
{
printf("%d\n", a[i]);
}
}
}
return 0;
}
|
2 | 642 | struct a{
int n;
char s[27];
}b[1000];
int main()
{
int n;
scanf("%d",&n);
int i,k;
for(i=0;i<n;i++)
{
scanf("%d %s",&b[i].n,b[i].s);
}
int c[26]={0};
for(i=0;i<n;i++)
{
for(k=0;b[i].s[k];k++)
{switch(b[i].s[k]){
case 'A':c[0]++;break;
case 'B':c[1]++;break;
case 'C':c[2]++;break;
case 'D':c[3]++;break;
case 'E':c[4]++;break;
case 'F':c[5]++;break;
case 'G':c[6]++;break;
case 'H':c[7]++;break;
case 'I':c[8]++;break;
case 'J':c[9]++;break;
case 'K':c[10]++;break;
case 'L':c[11]++;break;
case 'M':c[12]++;break;
case 'N':c[13]++;break;
case 'O':c[14]++;break;
case 'P':c[15]++;break;
case 'Q':c[16]++;break;
case 'R':c[17]++;break;
case 'S':c[18]++;break;
case 'T':c[19]++;break;
case 'U':c[20]++;break;
case 'V':c[21]++;break;
case 'W':c[22]++;break;
case 'X':c[23]++;break;
case 'Y':c[24]++;break;
case 'Z':c[25]++;break;
}}
}
int j,max=0;
for(i=0;i<26;i++)
{
if(c[i]>max)
{ max=c[i];
j=i;}
}
int t=0;
switch(j){
case 0:printf("A\n%d\n",max);
for(i=0;i<n;i++)
{
for(k=0;b[i].s[k];k++)
{
if(b[i].s[k]=='A')
printf("%d\n",b[i].n);
}
}
break;
case 1:printf("B\n%d\n",max);
for(i=0;i<n;i++)
{
for(k=0;b[i].s[k];k++)
if(b[i].s[k]=='B')
printf("%d\n",b[i].n);
}
break;
case 2:printf("C\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='C')printf("%d\n",b[i].n);}break;
case 3:printf("D\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='D')printf("%d\n",b[i].n);}break;
case 4:printf("E\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='E')printf("%d\n",b[i].n);}break;
case 5:printf("F\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='F')printf("%d\n",b[i].n);}break;
case 6:printf("G\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='G')printf("%d\n",b[i].n);}break;
case 7:printf("H\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='H')printf("%d\n",b[i].n);}break;
case 8:printf("I\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='I')printf("%d\n",b[i].n);}break;
case 9:printf("J\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='J')printf("%d\n",b[i].n);}break;
case 10:printf("K\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='K')printf("%d\n",b[i].n);}break;
case 11:printf("L\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='L')printf("%d\n",b[i].n);}break;
case 12:printf("M\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='M')printf("%d\n",b[i].n);}break;
case 13:printf("N\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='M')printf("%d\n",b[i].n);}break;
case 14:printf("O\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='O')printf("%d\n",b[i].n);}break;
case 15:printf("P\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='P')printf("%d\n",b[i].n);}break;
case 16:printf("Q\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='Q')printf("%d\n",b[i].n);}break;
case 17:printf("R\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='R')printf("%d\n",b[i].n);}break;
case 18:printf("S\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='S')printf("%d\n",b[i].n);}break;
case 19:printf("T\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='T')printf("%d\n",b[i].n);}break;
case 20:printf("U\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='U')printf("%d\n",b[i].n);}break;
case 21:printf("V\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='V')printf("%d\n",b[i].n);}break;
case 22:printf("W\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='W')printf("%d\n",b[i].n);}break;
case 23:printf("X\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='X')printf("%d\n",b[i].n);}break;
case 24:printf("Y\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='Y')printf("%d\n",b[i].n);}break;
case 25:printf("Z\n%d\n",max);for(i=0;i<n;i++){for(k=0;b[i].s[k];k++)if(b[i].s[k]=='Z')printf("%d\n",b[i].n);}break;
}
return 0;
}
|
2 | 643 |
void main()
{
int n,i,k[100],l[26]={0},m=0,v,j;
char c[100][26];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&k[i],c[i]);
for(j=0;j<strlen(c[i]);j++)
{
l[(int)c[i][j]-65]+=1;
}
}
for(i=0;i<26;i++)
{
if(l[i]>m)
m=l[i];
}
for(i=0;i<26;i++)
{
if(l[i]==m)
{
printf("%c\n%d\n",i+65,l[i]);
break;
}
}
for(v=0;v<n;v++)
{
for(j=0;j<strlen(c[v]);j++)
{
if(c[v][j]==i+65)
printf("%d\n",k[v]);
}
}
} |
2 | 644 |
int main(){
int n,i,j,k,b[999],max=0,a[27],x;
char w,c[999][26],d[27];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&b[i],c[i]);
}
for(i=0;i<27;i++)
{a[i]=0;}
for(i=0;i<n;i++){
for(j=0;j<26;j++){
for(k=65;k<91;k++){
if(c[i][j]==k)
a[k-64]++;
}
}
}
for(i=1;i<27;i++){
if(a[i]>max)
{max=a[i];
x=i;}
}
w=x+64;
printf("%c\n",w);
printf("%d\n",max);
for(i=0;i<n;i++){
for(j=0;j<26;j++){
if(c[i][j]==x+64)
{printf("%d\n",b[i]);
break;}
}
}
return 0;
}
|
2 | 645 | struct shu
{
int bianhao;
char name[26];
}shu[999];
int main ()
{
int m;
scanf("%d",&m);
int i,j,k;
int jishu[26]={0};
int beiyong[26];
for (i=0;i<m;i++)
scanf("%d %s",&shu[i].bianhao,shu[i].name);
for (i=0;i<26;i++)
{
for (j=0;j<m;j++)
{
for (k=0;k<26;k++)
{
if (shu[j].name[k]==i+'A')
jishu[i]++;
}
}
}
for (i=0;i<26;i++)
beiyong[i]=jishu[i];
int max=0;
for (i=0;i<26;i++)
{
if (beiyong[i]>max)
max=beiyong[i];
}
int t;
for (i=0;i<26;i++)
{
if (jishu[i]==max)
t=i;
}
printf("%c\n",t+'A');
printf("%d\n",max);
for (i=0;i<m;i++)
{
for (j=0;j<26;j++)
{
if (shu[i].name[j]==t+'A')
printf("%d\n",shu[i].bianhao);
}
}
} |
2 | 646 |
struct book
{
int num;
char name[100];
struct book *next;
};
struct book *creat(int n)
{
int k=1;
struct book *head,*p1,*p2,*p;
p1=(struct book *)malloc(sizeof(struct book));
head=p1;p2=p1;p=p1;
scanf("%d %s",&p1->num,p1->name);
p1->next=NULL;
do
{
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
p2->next=p1;
p2=p1;
p1->next=NULL;
k++;
}while(k<n);
return head;
}
int main(void)
{
struct book *head,*p;
char *q;
int *s;
int n,i,j,max=0;
s=(int *)malloc(26*sizeof(int));
for(i=0;i<26;i++)
*(s+i)=0;
scanf("%d",&n);
head=creat(n);
p=head;
while(p)
{
q=p->name;
while(*q!='\0')
{ *(s+*(q)-'A')+=1;q++;}
p=p->next;
}
max=0;
for(i=0;i<26;i++)
if(*(s+i)>max)
max=*(s+i);
for(i=0;i<26;i++)
if(*(s+i)==max) break;
printf("%c\n%d\n",'A'+i,max);
p=head;
while(p)
{
q=p->name;
if(strchr(q,'A'+i)!=NULL)
printf("%d\n",p->num);
p=p->next;
}
}
|
2 | 647 |
int main()
{
int n, i;
scanf("%d", &n);
struct
{
int name;
char author[26];
}
book[999];
for(i = 0; i < n; i++)
{
scanf("%d%s", &book[i].name, book[i].author);
}
char t, tmax;
int max = 0, j, k;
for(t = 'A'; t <= 'Z'; t++)
{
k = 0;
for(i = 0; i < n; i++)
{
for(j = 0; j < strlen(book[i].author); j++)
{
if(book[i].author[j] == t)
{
k++;
}
}
}
if(k > max)
{
max = k;
tmax = t;
}
}
printf("%c\n%d\n", tmax, max);
for(i = 0; i < n; i++)
{
for(j = 0; j < strlen(book[i].author); j++)
{
if(book[i].author[j] == tmax)
{
printf("%d\n", book[i].name);
break;
}
}
}
return 0;
} |
2 | 648 | void main()
{
int n,i,j,max=0,seq=0;
int a[26]={0};
scanf("%d",&n);
struct book
{
int num;
char str[26];
}book[999];
for(i=0;i<n;i++)
scanf("%d %s",&book[i].num,&book[i].str);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
a[(book[i].str[j]-65)]++;
}
for(i=0;i<26;i++)
if (a[i]>max) {max=a[i];seq=i;}
printf("%c\n",seq+65);
printf("%d\n",max);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
if (book[i].str[j]==seq+65) {printf("%d\n",book[i].num); break;}
}
}
|
2 | 649 | int main()
{
int m, book[1002], i, cnt[26] = {0}, l, j, n = 0;
char name[1002][27], a, max ;
cin >> m;
for (i = 0; i < m; i++)
{
cin >> book[i];
cin >> name[i];
l = strlen(name[i]);
for (j = 0; j < l; j++)
{
a = name[i][j];
cnt[a - 'A']++;
}
}
for (i = 0; i < 26; i++)
{
if (cnt[i] > n)
{
n = cnt[i];
max = i + 'A';
}
}
cout << max << endl;
cout << n << endl;
for (i = 0; i < m; i++)
{
l = strlen (name[i]);
for (j = 0; j < l; j++)
{
if (name[i][j] == max)
{
cout << book[i] << endl;
break;
}
}
}
return 0;
} |
2 | 650 | int main()
{
int n, i, j, k, f=0, c, d;
struct aut
{ int num;
char wrt[26];
}a[999];
char wr[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int g[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&a[i].num,a[i].wrt);
c=strlen(a[i].wrt);
for(j=0;j<c;j++)
{
for(k=0;k<26;k++)
{
if(a[i].wrt[j]==wr[k]) g[k]=g[k]+1;
}
}
}
for(i=0;i<26;i++)
{
if(f<g[i])
{
f=g[i];
d=i;
}
}
printf("%c\n%d\n",wr[d],f);
for(i=0;i<n;i++)
{
c=strlen(a[i].wrt);
for(j=0;j<c;j++)
{
if(a[i].wrt[j]==wr[d])
{
printf("%d\n",a[i].num);
break;
}
}
}
return 0;
}
|
2 | 651 | struct b
{
int na;
char au[20];
}book[1000];
int main()
{
int m,i,len[1000],num[128]={0},j,max,p=0;
char maxi;
int boo[1000];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d%s",&book[i].na,book[i].au);
len[i]=strlen(book[i].au);
for(j=0;j<len[i];j++)
num[book[i].au[j]]++;
}
maxi='A';
max=-1;
for(j='A';j<='Z';j++)
{
if(num[j]>max)
{
max=num[j];
maxi=j;
}
}
printf("%c\n",maxi);
printf("%d\n",max);
for(i=0;i<m&&p<max;i++)
{
for(j=0;j<len[i];j++)
{
if(book[i].au[j]==maxi)
{
printf("%d\n",book[i].na);
p++;
break;
}
}
}
return 0;
} |
2 | 652 | struct book
{
char id[11];
char name[30];
};
struct au
{
int num;
char id[1000][11];
};
void main()
{
struct book b;
struct au a[26];
int n,i,j=0,k;
char c;
for(i=0;i<26;i++)
a[i].num=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s%s",b.id,b.name);
while(b.name[j]!='\0')
{
k=b.name[j]-'A';
strcpy(a[k].id[a[k].num],b.id);
a[k].num++;
j++;
}
j=0;
}
k=0;
j=0;
for(i=0;i<26;i++)
{
j=(a[i].num>k)? i:j;
k=(a[i].num>k)? a[i].num:k;
}
printf("%c\n",'A'+j);
printf("%d\n",k);
for(i=0;i<k;i++)
printf("%s\n",a[j].id[i]);
} |
2 | 653 | struct book
{
int num;
char wr[26];
};
int main()
{
int n,b[91][1000],max=0,i,j,k,s,m,writer;
struct book bk[1000];
scanf("%d",&n);//??????//
for(i=0;i<n;i++)
{
scanf("%d%s",&bk[i].num,bk[i].wr);
}//?????????//
for(i=0;i<26;i++)//?????//
{
s=0;
for(j=0;j<n;j++)//???????i???//
{
m=strlen(bk[j].wr);//??????//
for(k=0;k<m;k++)
{
if(bk[j].wr[k]==i+65)
{
b[i][s]=bk[j].num;//??i+65??s+1?????//
s++;
k=m;
}
}
}
if(s>max)//s???i?????//
{
max=s;
writer=i;
}
}
printf("%c\n%d",writer+65,max);
for(i=0;i<max;i++)
printf("\n%d",b[writer][i]);
return 0;
} |
2 | 654 | struct student
{
int num;
char s[100];
struct student *next;
};
void main()
{
struct student *p1,*p2,*head;
int n,i,j,k,m,a[100];
char c[100],nam[100][100];
for(i=0;i<26;i++)
{ c[i]=i+65; a[i]=0;} //??
scanf("%d",&n);
p1=p2=head=(struct student*)malloc(LEN);
scanf("%d %s",&p1->num,p1->s);
for(i=1;i<n;i++)
{
p1=(struct student*)malloc(LEN);
scanf("%d %s",&p1->num,p1->s);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
p1=head;
i=0;
while(p1!=NULL)
{
strcpy(nam[i],p1->s);
i++;
p1=p1->next;
}
p1=head;
for(k=0;k<n;k++)
{
//printf("%s\n",nam[k]);//????????nam[k]???????????????????????????????????????
?????//???
for(i=0;i<26;i++)
{
for(j=0;nam[k][j]!='\0';j++)
if(nam[k][j]==c[i])
a[i]++;
}
}
k=a[0];
for(i=0;i<26;i++)
{
if(a[i]>k)
k=a[i];
}
for(i=0;i<26;i++)
{
if(a[i]==k)
{ printf("%c\n%d",c[i],a[i]);
m=i;
break;
}
}
p1=head;
for(i=0;i<n;i++)
{
for(j=0;nam[i][j]!='\0';j++)
{
if(nam[i][j]==c[m])
printf("\n%d",p1->num);
}
p1=p1->next;
}
}
|
2 | 655 | struct
{
int num;
char name[27];
}book[999];
struct
{
int cishu;
}ren[26];
int main()
{
int n,zimu,a,b,i,j;
int sz[26];
char m;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i].num,book[i].name);
}
for(i=0;i<n;i++)
{
for(j=0;book[i].name[j]!='\0';j++)
{
zimu=book[i].name[j]-65;
ren[zimu].cishu++;
}
}
a=0;
b=ren[0].cishu;
for(i=1;i<26;i++)
{
if(ren[i].cishu>b)
{
a=i;
b=ren[i].cishu;
}
}
m=a+65;
printf("%c\n",m);
printf("%d\n",b);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(book[i].name[j]==m)
{
printf("%d\n",book[i].num);
}
}
}
return 0;
}
|
2 | 656 | main()
{
int n,i,j,max=0,maxp;
scanf("%d",&n);
int a[n];
int person[26]={0};
char writer[n][26];
for (i=0;i<n;i++)
{
scanf("%d %s",&a[i],writer[i]);
for (j=0;j<strlen(writer[i]);j++)
{
person[writer[i][j]-'A']++;
}
}
for (i=0;i<26;i++)
{
if (max<person[i])
{
max=person[i];
maxp=i;
}
}
printf("%c\n%d\n",maxp+'A',max);
for(i=0;i<n;i++)
for(j=0;j<strlen(writer[i]);j++)
{
if (writer[i][j]=='A'+maxp)
printf("%d\n",a[i]);
}
}
|
2 | 657 | int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;
int max = 0;
char maxn;
struct book
{
int id;
char author[28];
}*bb;
void find ( int ii );
int main()
{
int n;
scanf("%d",&n);
int ii;
bb = ( struct book * ) malloc ( sizeof ( struct book ) * n );
for ( ii = 0; ii < n ; ii++ )
{
scanf("%d %s",&bb[ii].id,bb[ii].author);
}
for ( ii = 0 ; ii < n ; ii++ )
{
find (ii);
}
printf("%c\n",maxn);
printf("%d\n",max);
int jj;
for ( ii = 0 ; ii < n ; ii++ )
{
for ( jj = 0 ; bb[ii].author[jj] != '\0' ; jj++)
{
if ( bb[ii].author[jj] == maxn )
{
printf("%d\n",bb[ii].id);
}
}
}
free(bb);
return 0;
}
void find ( int ii )
{
int aa = 0;
for ( aa = 0 ; bb[ii].author[aa] != '\0' ; aa++ )
{
switch(bb[ii].author[aa])
{
case 'A':{a++;if ( a > max ) max = a,maxn = 'A' ; break;}
case 'B':{b++;if ( b > max ) max = b,maxn = 'B' ; break;}
case 'C':{c++;if ( c > max ) max = c,maxn = 'C' ; break;}
case 'D':{d++;if ( d > max ) max = d,maxn = 'D' ; break;}
case 'E':{e++;if ( e > max ) max = e,maxn = 'E' ; break;}
case 'F':{f++;if ( f > max ) max = f,maxn = 'F' ; break;}
case 'G':{g++;if ( g > max ) max = g,maxn = 'G' ; break;}
case 'H':{h++;if ( h > max ) max = h,maxn = 'H' ; break;}
case 'I':{i++;if ( i > max ) max = i,maxn = 'I' ; break;}
case 'J':{j++;if ( j > max ) max = j,maxn = 'J' ; break;}
case 'K':{k++;if ( k > max ) max = k,maxn = 'K' ; break;}
case 'L':{l++;if ( l > max ) max = l,maxn = 'L' ; break;}
case 'M':{m++;if ( m > max ) max = m,maxn = 'M' ; break;}
case 'N':{n++;if ( n > max ) max = n,maxn = 'N' ; break;}
case 'O':{o++;if ( o > max ) max = o,maxn = 'O' ; break;}
case 'P':{p++;if ( p > max ) max = p,maxn = 'P' ; break;}
case 'Q':{q++;if ( q > max ) max = q,maxn = 'Q' ; break;}
case 'R':{r++;if ( r > max ) max = r,maxn = 'R' ; break;}
case 'S':{s++;if ( s > max ) max = s,maxn = 'S' ; break;}
case 'T':{t++;if ( t > max ) max = t,maxn = 'T' ; break;}
case 'U':{u++;if ( u > max ) max = u,maxn = 'U' ; break;}
case 'V':{v++;if ( v > max ) max = v,maxn = 'V' ; break;}
case 'W':{w++;if ( w > max ) max = w,maxn = 'W' ; break;}
case 'X':{x++;if ( x > max ) max = x,maxn = 'X' ; break;}
case 'Y':{y++;if ( y > max ) max = y,maxn = 'Y' ; break;}
case 'Z':{z++;if ( z > max ) max = z,maxn = 'Z' ; break;}
}
}
}
|
2 | 658 | void main()
{
int i,n,t[27],max;
char p,a[100][27],b[100][27];
scanf("%d",&n);
for(i=1;i<=26;i++) t[i]=0;
for(i=1;i<=n;i++) scanf("%s%s",a[i],b[i]);
for(p='A';p<='Z';p++)
for(i=1;i<=n;i++)
if(strchr(b[i],p)) t[p-'A'+1]++;
max=1;
for(i=2;i<=26;i++)
if(t[max]<t[i]) max=i;
printf("%c\n",p='A'+max-1);
printf("%d\n",t[p-'A'+1]);
for(i=1;i<=n;i++)
if(strchr(b[i],p)) printf("%s\n",a[i]);
}
|
2 | 659 | int main()
{
int i,j,k,t,m,c[26]={0},max=0;
char b[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
struct book
{
int num;
char man[26];
}a[999];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i].num,a[i].man);
}
i=0;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
for(k=0;k<26;k++)
{
if(a[i].man[j]==b[k])
c[k]=c[k]+1;
}
}
}
i=0;j=0;k=0;
for(i=0;i<26;i++)
{
if(c[i]>max)
{
max=c[i];
t=i;
}
}
printf("%c\n%d\n",b[t],max);
for(j=0;j<m;j++)
{
for(k=0;k<26;k++)
{
if(a[j].man[k]==b[t])
printf("%d\n",a[j].num);
}
}
}
|
2 | 660 |
struct book{
int num;
char s[27];
};
struct author{
int num;
int bn[1000];
};
int main()
{
int m,i,j,l,max=0;
char c;
struct book bk[1000];
struct author au['Z'+1],t;
scanf("%d",&m);
for(j=0;j<'Z'+1;j++)
au[j].num=0;
for(i=0;i<m;i++)
{
scanf("%d %s",&bk[i].num,bk[i].s);
l=strlen(bk[i].s);
for(j=0;j<l;j++)
au[bk[i].s[j]].bn[au[bk[i].s[j]].num++]=bk[i].num;
}
for(j=0;j<'Z'+1;j++)
if(au[j].num>max)
{ t=au[j];
c=j;
max=au[j].num;}
printf("%c\n",c);
printf("%d\n",t.num);
for(i=0;i<t.num;i++)
printf("%d\n",t.bn[i]);
return 0;
}
|
2 | 661 |
int N;
struct stu
{
int num;
char au[50];
struct stu *next;
};
struct stu *creat() //????
{
struct stu *p1,*p2,*head;
int i;
for(i=0;i<N;i++)
{
p2=p1;
p1=Z;
scanf("%d%s",&p1->num,p1->au);
p1->next=0;
if(i==0) head=p1;
else p2->next=p1;
}
return head;
}
void main()
{
struct stu *head,*p;
int i,n,j,max,max1;
int c[26]={0}; //?????????????c[i]??ASC??i+A????????
int d[26][1000]={0}; //??????????????d[i]??ASC??i+A???????
int e[26]={0}; //??1???e[],????????d[]???????????????????
scanf("%d",&N);
head=creat();
for(p=head;p!=0;p=p->next)
{
n=strlen(p->au);
for(i=0,j=0;i<n;i++)
{
c[p->au[i]-'A']++;
d[p->au[i]-'A'][e[p->au[i]-'A']++]=p->num; //??2??e[]?????j???????j????????0
}
}
for(i=0,max=0;i<26;i++)
{
if(max<c[i])
{
max1=i;
max=c[i]; //??3?????????????max????????????0
}
}
printf("%c\n",max1+'A'); //??3??????
printf("%d\n",c[max1]); //??4???????????
i=0;
while(d[max1][i]!=0)
printf("%d\n",d[max1][i++]);
} |
2 | 662 | struct shu
{
int num;
char a[26];
struct shu*next;
};
int main()
{
char ma='A';
struct shu *p1,*p2;
struct shu*head,*p;
int cnt[128]={0};
int i,j,n,m;
scanf("%d",&n);
p1=p2=(struct shu*)malloc(l);
scanf("%d%s",&p1->num,p1->a);
m=strlen(p1->a);
for(j=0;j<m;j++){
if(++cnt[p1->a[j]]>cnt[ma])
ma=p1->a[j];
}
head=NULL;
for(i=1;i<n;i++){
if(i==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct shu*)malloc(l);
scanf("%d%s",&p1->num,p1->a);
m=strlen(p1->a);
for(j=0;j<m;j++){
if(++cnt[p1->a[j]]>cnt[ma])
ma=p1->a[j];
}
}
p2->next=p1;
p2=p1;
p2->next=NULL;
p=head;
printf("%c\n%d\n",ma,cnt[ma]);
while(p!=NULL){
m=strlen(p->a);
for(i=0;i<m;i++){
if(p->a[i]==ma){
printf("%d\n",p->num);
break;
}
}
p=p->next;
}
return 0;
}
|
2 | 663 |
struct BOOK
{
int num;
char name[26];
int name_num[26];
}book[999];
void main()
{
int n; //????//
scanf("%d",&n);
int i;
for(i=0;i<n;i++){
scanf("%d%s",&book[i].num,&book[i].name); //??????????????????i??j????????????//
}
int count[26]={0};
int k;
for(i=0;i<n;i++){
int len;
len=strlen(book[i].name);
for(k=0;k<len;k++){
book[i].name_num[k]=(int)book[i].name[k];
}
}
int j;
int y;
for(i=0;i<n;i++){
int len_1;
len_1=strlen(book[i].name);
for(j=65;j<=90;j++){
for(y=0;y<len_1;y++){
if(book[i].name_num[y]==j){
count[j-65]++;
}
}
}
}
int w;
int max=count[0];
int t=0;
for(w=0;w<26;w++){
if(count[w]>max){
max=count[w];
t=w;
}
}
printf("%c\n%d\n",t+65,max);
int x;
int total=0;
for(i=0;i<n;i++){
int length;
length=strlen(book[i].name);
for(x=0;x<length;x++){
if(book[i].name_num[x]==t+65){
printf("%d\n",book[i].num);
}
}
}
} |
2 | 664 | struct author{
int sumbook;
int id[999];
}a[26];
int main(){
int n,i,j,bookid=0,pos=0,maxbook=0,maxid=0;
char booka[26];
scanf("%d",&n);
for(i=0;i<n;++i){
scanf("%d%s",&bookid,booka);
for(j=0;j<strlen(booka);++j){
pos=booka[j]-'A';
a[pos].id[a[pos].sumbook]=bookid;
a[pos].sumbook++;
if(maxbook<a[pos].sumbook){
maxid=pos;
maxbook=a[pos].sumbook;
}
}
}
printf("%c\n%d\n",maxid+'A',maxbook);
for(i=0;i<a[maxid].sumbook;i++)
printf("%d\n",a[maxid].id[i]);
}
|
2 | 665 |
struct author {
char id;
int count;
int books[1000];
};
int cmp(const void *a, const void *b) {
const struct author *pa = (const struct author *) a;
const struct author *pb = (const struct author *) b;
return pb->count - pa->count;
}
int main() {
int i, j, num, id, len, idx;
struct author authors[26]; // 'A' -- 'Z'
char c;
char buffer[26];
for (i = 0; i < 26; ++i) {
authors[i].id = 'A' + i;
authors[i].count = 0;
}
scanf("%d", &num);
for (i = 0; i < num; ++i) {
scanf("%d %s", &id, buffer);
len = strlen(buffer);
for (j = 0; j < len; ++j) {
idx = buffer[j] - 'A';
authors[idx].books[authors[idx].count] = id;
authors[idx].count++;
}
}
qsort(authors, 26, sizeof(struct author), cmp);
printf("%c\n", authors[0].id);
printf("%d\n", authors[0].count);
for (i = 0; i < authors[0].count; ++i)
printf("%d\n", authors[0].books[i]);
}
|
2 | 666 |
int main()
{
struct bookst
{
int Num;
char name[26];
};
struct bookst *book;
int cnt[26], num, i, j, max=0, max_idx=0;
for(i=0;i<26;i++)
cnt[i]=0;
scanf("%d",&num);
book=(struct bookst *)malloc(num*sizeof(struct bookst));
for(i=0;i<num;i++)
{
scanf("%d%s",&book[i].Num,book[i].name);
for(j=0;book[i].name[j]!=0;j++)
{
cnt[book[i].name[j]-'A']++;
}
}
for(i=0;i<26;i++)
{
if(cnt[i]>max)
{
max=cnt[i];
max_idx=i;
}
}
printf("%c\n%d\n",'A'+max_idx,max);
for(i=0;i<num;i++)
{
for(j=0;book[i].name[j]!=0;j++)
{
if(book[i].name[j]=='A'+max_idx)
printf("%d\n",book[i].Num);
}
}
return 0;
} |
2 | 667 |
struct list
{
int book;
char name[30];
};
int main(int argc, char *argv[])
{
int n,i,j;
scanf("%d",&n);
int a[26];
struct list shelf[n];
for (i=0;i<=25;i++)
a[i]=0;
for (i=0;i<=n-1;i++)
{
scanf("%d%s",&shelf[i].book,shelf[i].name);
for (j=0;j<=strlen(shelf[i].name)-1;j++)
a[shelf[i].name[j]-'A']++;
}
int max,flag=0,add=0,temp=0;
max=a[0];
for (i=0;i<=25;i++)
{
if (max<a[i])
{max=a[i];flag=i;}
}
printf("%c\n",flag+'A');
printf("%d\n",max);
for (i=0;i<=n-1;i++)
{
for (j=0;j<=strlen(shelf[i].name)-1;j++)
{
if (shelf[i].name[j]==flag+'A')
add++;
}
}
for (i=0;i<=n-1;i++)
{
for (j=0;j<=strlen(shelf[i].name)-1;j++)
{
if (shelf[i].name[j]==flag+'A')
{printf("%d",shelf[i].book);
temp++;
(temp<add)?printf("\n"):printf("");
break;
}
}
}
return 0;
}
|
2 | 668 | int main()
{
int n,len,i,j,book[1000],num[26]={0},k=0,t,m=0;
char w[1000][27],c='A';
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i],w[i]);
len=strlen(w[i]);
for(j=0;j<len;j++)
{
for(c='A',t=0;c<='Z';c++)
{
if(w[i][j]==c)
{
num[t]++;
break;
}
t++;
}
}
}
for(i=0;i<26;i++)
{
if(num[i]>m)
{
m=num[i];
k=i;
}
}
c='A'+k;
printf("%c\n",c);
printf("%d\n",num[k]);
for(i=0;i<n;i++)
{
len=strlen(w[i]);
for(j=0;j<len;j++)
{
if(w[i][j]==c)
{
printf("%d\n",book[i]);
break;
}
}
}
return 0;
}
|
2 | 669 | struct shu
{
int num;
char author_name[27];
};
int main()
{
int ere[26];
int m,i,max=0,key;
for(i=0;i<26;i++)
{
ere[i]=0;
}
char *a;
struct shu book[999];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&book[i].num);
scanf("%s",book[i].author_name);
}
for(i=0;i<m;i++)
{
a=book[i].author_name;
while(*a!='\0')
{
ere[(*a)-'A']++;
a++;
}
}
for(i=0;i<26;i++)
{
if(ere[i]>=max)
{
max=ere[i];
key=i;
}
}
printf("%c\n",(key+'A'));
printf("%d\n",ere[key]);
for(i=0;i<m;i++)
{
a=book[i].author_name;
while(*a!='\0')
{
if((key+'A')==*a)
{
printf("%d\n",book[i].num);
break;
}
a++;
}
}
return 0;
}
|
2 | 670 |
int main()
{
char author[27];
int i,j,n,no,ab[26][1000]={0},an[26]={0},ma=0,na,am;
cin>>n;
for(;n>0;n--){
cin>>no>>author;
for(i=0;i<27;i++)
if(author[i]!='\0')ab[author[i]-'A'][an[author[i]-'A']]=no,an[author[i]-'A']++;
else break;}
for(i=0;i<26;i++)
{
na=0;
for(j=0;j<999;j++)
if(ab[i][j]!=0)na++;
else break;
if(na>ma)
ma=na,am=i;
}
cout<<(char)('A'+am)<<endl<<ma<<endl;
for(i=0;i<1000;i++)
if(ab[am][i]!=0)cout<<ab[am][i]<<endl;
else break;
return 0;
}
|
2 | 671 | struct book
{ int n;
struct book *next;
};
struct au
{
char n;
int s;
struct book *p;
};
void main()
{
int i,j,k,l,m,n,*p,a[100][1100]={0},max=0,b[100]={0};
char s[30];
scanf("%d",&n);
for(l=1;l<=n;l++)
{
scanf("%d",&j);
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
b[s[i]]++;
a[s[i]][b[s[i]]]=j;
if(b[s[i]]>b[max]) max=s[i];
}
}
printf("%c\n",(char)max);
printf("%d\n",b[max]);
for(i=1;i<=b[max];i++)
printf("%d\n",a[max][i]);
} |
2 | 672 |
struct book{
int num;
char aut[100];
}b[200000];
int count[1000]={0};
int main()
{
int n,max=0,maxnum,i,j,f;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d %s", &b[i].num, b[i].aut);
for(j=0;j<strlen(b[i].aut);j++){count[b[i].aut[j]]++;}
}
for(i='A';i<='Z';i++){
if(count[i]>max){
max=count[i];
maxnum=i;
}
}
printf("%c\n%d\n", maxnum, max);
for(i=1;i<=n;i++){
f=0;
for(j=0;j<strlen(b[i].aut);j++){
if(b[i].aut[j]==maxnum){f=1;}
}
if(f==1){printf("%d\n", b[i].num);}
}
return 0;
}
|
2 | 673 | int main()
{
int m,i,num[26]={0},index1;
scanf("%d",&m);
struct f
{
int index;
char writer[27];
};
struct f *p;
p=(struct f *)malloc(m*sizeof(struct f));//???????
char *p1;
for(i=0;i<m;i++)
{
scanf("%d %s",&(p+i)->index,(p+i)->writer);//????
}
for(i=0;i<m;i++)
{
p1=(p+i)->writer;
for(;*p1;p1++)
{ index1=(int)*p1-'A';//??????????????????
(*(num+index1))++;}
}
int max=0,k;
for(i=0;i<26;i++)
if(max<*(num+i)) {max=*(num+i);k=i;}//?????????
char wr;
wr=(char)k+'A';
printf("%c\n%d\n",wr,max);
int flag;
for(i=0;i<m;i++)
{
p1=(p+i)->writer;
flag=1;
for(;*p1&&flag==1;p1++)
if(*p1==wr) flag=0;
if(flag==0) printf("%d\n",(p+i)->index);//??????????????????????
}
} |
2 | 674 | struct lib
{
int num;
char author[26];
}book[1000];
int main()
{
int n,i,k,p,e;
e=0;
int tol[1000]={0};
int own[1000][1000];
scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d%s",&(book[i].num),book[i].author);
}
for(k='A';k<='Z';k++){
for(i=0;i<=n-1;i++){
for(p=0;p<=25;p++){
if(k==book[i].author[p]){
tol[k]++;
own[k][i]=book[i].num;
}
}
}
}
for(i='A';i<='Z';i++){
if(tol[i]>e){
e=tol[i];
}
}
for(k='A';k<='Z';k++){
if(tol[k]==e){
printf("%c\n%d\n",k,tol[k]);
for(p=0;p<=n-1;p++){
if(own[k][p]!=0){
printf("%d\n",own[k][p]);
}
}
break;
}
}
return 0;
} |
2 | 675 | struct book
{
int num;
char a[26];
struct book *next;
};
void main()
{
struct book *head,*p,*s;
head=(struct book *)malloc(sizeof(struct book));
head->next=NULL;
int n,i,j,c[26]={0},max,maxj;
char b[26];
for(j=0;j<26;j++)
b[j]=65+j;
scanf("%d",&n);
p=head;
for(i=0;i<n;i++)
{
s=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&s->num,s->a);
s->next=NULL;
p->next=s;
p=s;
}
for(p=head->next;p!=NULL;p=p->next)
{
for(i=0;p->a[i]!='\0';i++)
for(j=0;j<26;j++)
if(p->a[i]==b[j])
c[j]++;
}
// for(j=0;j<26;j++)
// printf("%c %d\n",b[j],c[j]);
max=c[0];
maxj=0;
for(j=1;j<26;j++)
if(c[j]>max)
{
max=c[j];
maxj=j;
}
printf("%c\n",b[maxj]);
printf("%d\n",c[maxj]);
for(p=head->next;p!=NULL;p=p->next)
for(i=0;p->a[i]!='\0';i++)
if(p->a[i]==b[maxj])
printf("%d\n",p->num);
}
|
2 | 676 |
void main()
{
struct book
{
int num;
char wri[26];
}*s;
int n,i,j,a[100],t;
char c;
s=(struct book *)malloc(n*sizeof(struct book));
for(i=0;i<100;i++)
a[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&(*(s+i)).num,(*(s+i)).wri);
for(i=0;i<n;i++)
for(j=0;(*(s+i)).wri[j]!='\0';j++)
{
for(c='A';c<='Z';c++)
if(s[i].wri[j]==c) a[s[i].wri[j]]++;
}
for(i=0;i<100;i++)
if(a[0]<a[i]) {a[0]=a[i];t=i;}
printf("%c\n",t);
printf("%d\n",a[t]);
for(i=0;i<n;i++)
for(j=0;(*(s+i)).wri[j]!='\0';j++)
{if(s[i].wri[j]==t) printf("%d\n",s[i].num);}
}
|
2 | 677 | int main()
{
int n,max,t,i,j,a[1000],l,b[30]={0},c;
char str[1000][20];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&a[i],str[i]);
l=strlen(str[i]);
for(j=0;j<l;j++){
b[str[i][j]-64]++;
}
}
for(i=1;i<27;i++){
if(b[i]>max){
max=b[i];
t=i;
}
}
printf("%c\n%d\n",t+64,b[t]);
for(i=0;i<n;i++){
l=strlen(str[i]);
for(j=0;j<l;j++){
if(str[i][j]==t+64)
printf("%d\n",a[i]);
}
}
return 0;
} |
2 | 678 | void main()
{
struct book
{
int bianhao;
char zuozhe[100];
}a[1000];
int i,j,n,l,max;
int b[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i].bianhao,a[i].zuozhe);
for(i=0;i<n;i++)
for(j=0;a[i].zuozhe[j]!='\0';j++)
b[a[i].zuozhe[j]-65]++;
max=b[0];
l=0;
for(i=1;i<=25;i++)
{
if(b[i]>max)
{
max=b[i];
l=i;
}
}
printf("%c\n",l+65);
printf("%d\n",max);
for(i=0;i<n;i++)
for(j=0;a[i].zuozhe[j]!='\0';j++)
if(a[i].zuozhe[j]==(l+65))
{
printf("%d\n",a[i].bianhao);
break;
}
}
|
2 | 679 | int main()
{
int x[26]={0};
char c;
struct books
{
int number;
char name[27];
};
struct books book[1000];
int n,i,j,t,max=0;
struct books *p;
scanf("%d",&n);
for(p=book;p<book+n;p++)
scanf("%d%s",&p->number,p->name);
for(p=book;p<book+n;p++)
for(j=0;j<26;j++)
for(i=65;i<=90;i++)
if(p->name[j]==i)
x[i-65]++;
for(i=0;i<26;i++)
if(x[i]>max)
max=x[i];
for(i=0;i<26;i++)
if(x[i]==max)
break;
c=i+65;
printf("%c\n%d\n",c,max);
for(i=0;i<n;i++)
for(j=0;j<26;j++)
if(book[i].name[j]==c)
{
printf("%d\n",book[i].number);
break;
}
return 0;
}
|
2 | 680 | struct books
{
int num;
char name[100];
struct books *next;
};
struct books * create(int n)
{
struct books *head,*p1,*p2;
p1=(struct books*)malloc(Len);
scanf("%d %s",&p1->num,p1->name);
p1->next=NULL;
head=p1;
p2=p1;
while(--n)
{
p1=(struct books*)malloc(Len);
scanf("%d %s",&p1->num,p1->name);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
return head;
}
void main()
{
int n,i,max,k;
char *p;
int num[26]={0};
char name[26]={'A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
struct books *p1,*head;
scanf("%d",&n);
head=create(n);
p1=head;
for(i=0;i<26;i++)
{
p1=head;
p=p1->name;
do
{
if(*p==name[i])
{
num[i]++;
p1=p1->next;
p=p1->name;
}
else
{
if(*p=='\0')
{
p1=p1->next;
p=p1->name;
}
else
{
p++;
}
}
}while(p1!=NULL);
}
max=num[0];
for(i=0;i<26;i++)
{
if(num[i]>=max)
{
k=i;
max=num[i];//???????num[i]??max??????max????????????25
}
}
printf("%c\n",name[k]);
printf("%d\n",num[k]);
p1=head;
p=p1->name;
while(p1!=NULL)
{
if(*p==name[k])
{
printf("%d\n",p1->num);
p1=p1->next;
p=p1->name;
}
else
{
if(*p=='\0')
{
p1=p1->next;
p=p1->name;
}
else
{
p++;
}
}
}
} |
2 | 681 | void main()
{
int m,t,b[1000],a[26]={0},max;
char str[1000][30];
int i,j;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&b[i],str[i]);
for(j=0;str[i][j]!='\0';j++)
{
t=str[i][j]-'A';
a[t]++;
}
}
t=0;
max=a[0];
for(i=0;i<26;i++)
{
if(max<a[i])
{
max=a[i];
t=i;
}
}
printf("%c\n",'A'+t);
printf("%d\n",a[t]);
for(i=0;i<m;i++)
{
for(j=0;str[i][j]!='\0';j++)
{
if(str[i][j]=='A'+t)
printf("%d\n",b[i]);
}
}
} |
2 | 682 | int main()
{
int num[999] , count[27] = {0} , len[999];
int m , i , j , max = 0 , per;
cin >> m;
char ch[999][26] , person;
for (i = 1 ; i <= m ; i++)
{
cin >> num[i] >> ch[i];
len[i] = strlen (ch[i]);
for (j = 0 ; j <= len[i] - 1 ; j++)
{
count[ch[i][j] - 64]++;
}
}
for (i = 1 ; i <= 26 ; i++)
{
if (count[i] > max)
{
max = count[i];
per = i;
}
}
person = per + 64;
cout << person << endl;
cout << count[per] << endl;
for (i = 1 ; i <= m ; i++)
{
for (j = 0 ; j <= len[i] - 1 ; j++)
{
if (ch[i][j] == person)
{
cout << num[i] << endl;
break;
}
}
}
return 0;
}
|
2 | 683 | typedef char q[30];
void init(int a[],int f[],q *p[lll],int m)
{
int i;
char e[432];
char *pp;
int r;
for(i=1;i<=m;i++)
{
p[i]=(q *)malloc(sizeof(q));
scanf("%d%s",&f[i],p[i]);
getchar();
pp=*p[i];
while (*pp!='\0')
{a[*pp]++;
pp++;
}
}
}
char pro(int a[])
{
char c,max,g;
max=-333;
for (c='A';c<='Z';c++)
if (a[c]>max) {max=a[c];g=c;}
return g;
}
void print(int f[],q *p[lll],int m,char c)
{
int i;
for (i=1;i<=m;i++)
if (strchr(*p[i],c)!=NULL) printf("%d\n",f[i]);
}
int main()
{
int m,k;
int a[343]={0};
int f[lll];
q *p[lll];
char max;
//freopen("tt.in","r",stdin);
//freopen("tt.out","w",stdout);
scanf("%d",&m);
init(a,f,p,m);
max=pro(a);
printf("%c\n%d\n",max,a[max]);
print(f,p,m,max);
}
|
2 | 684 |
struct book
{
int num;
char name[27];
}book[1000];
int main(int argc, char* argv[])
{
int m,i,j,a[27],len,max=0,number;
char p;
for(i=1;i<=26;i++){
a[i]=0;
}
scanf("%d",&m);
for(i=1;i<=m;i++){
scanf("%d %s",&book[i].num,&book[i].name);
len=strlen(book[i].name);
for(j=0;j<=len-1;j++){
p=book[i].name[j];
a[p-64]+=1;
}
}
for(i=1;i<=26;i++){
if(a[i]>max){
max=a[i];
number=i;
}
}
printf("%c\n%d\n",number+64,a[number]);
for(i=1;i<=m;i++){
len=strlen(book[i].name);
for(j=0;j<=len-1;j++){
if(book[i].name[j]==number+64){
printf("%d\n",book[i].num);
}
}
}
return 0;
}
|
2 | 685 | struct books
{char num[20];
char w[26];};
int main()
{int k,j,i,m;
int b[150]={0};
scanf("%d",&m);
struct books a[1000];
for(i=0;i<m;i++)
{scanf("%s %s",a[i].num,a[i].w);
for(j=0;a[i].w[j]!='\0';j++)
b[a[i].w[j]]++;
}
int max=0;
for(i='A',j=0;i<='Z';i++)
if (max<b[i]) {max=b[i];j=i;}
printf("%c\n",j);
printf("%d\n",max);
int n=0;
for(i=0;i<m;i++)
{
n=0;
for(k=0;a[i].w[k]!='\0';k++)
if (a[i].w[k]==j)n=1;
if(n==1) printf("%s\n",a[i].num);
}
} |
2 | 686 |
char f(int y);
int main()
{
int m,i,j,number[1000],auther[26],total=0;
char name[1000][27];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %s",&number[i],name[i]);
int n;
n=strlen(name[i]);
for(j=0;j<n;j++){
switch(name[i][j]){
case'A':auther[0]++;break;
case'B':auther[1]++;break;
case'C':auther[2]++;break;
case'D':auther[3]++;break;
case'E':auther[4]++;break;
case'F':auther[5]++;break;
case'G':auther[6]++;break;
case'H':auther[7]++;break;
case'I':auther[8]++;break;
case'J':auther[9]++;break;
case'K':auther[10]++;break;
case'L':auther[11]++;break;
case'M':auther[12]++;break;
case'N':auther[13]++;break;
case'O':auther[14]++;break;
case'P':auther[15]++;break;
case'Q':auther[16]++;break;
case'R':auther[17]++;break;
case'S':auther[18]++;break;
case'T':auther[19]++;break;
case'U':auther[20]++;break;
case'V':auther[21]++;break;
case'W':auther[22]++;break;
case'X':auther[23]++;break;
case'Y':auther[24]++;break;
case'Z':auther[25]++;break;
}
}
}
int max=auther[0],k,t=0;
for(k=1;k<26;k++){
if(auther[k]>max){
max=auther[k];
t=k;
}
}
printf("%c\n",f(t));
for(i=0;i<m;i++){
int q;
q=strlen(name[i]);
for(j=0;j<q;j++){
if(name[i][j]==f(t))
total++;
}
}
printf("%d\n",total);
for(i=0;i<m;i++){
int p;
p=strlen(name[i]);
for(j=0;j<p;j++){
if(name[i][j]==f(t))
printf("%d\n",number[i]);
}
}
return 0;
}
char f(int y){
char x;
switch(y){
case 0:x='A';break;
case 1:x='B';break;
case 2:x='C';break;
case 3:x='D';break;
case 4:x='E';break;
case 5:x='F';break;
case 6:x='G';break;
case 7:x='H';break;
case 8:x='I';break;
case 9:x='J';break;
case 10:x='K';break;
case 11:x='L';break;
case 12:x='M';break;
case 13:x='N';break;
case 14:x='O';break;
case 15:x='P';break;
case 16:x='Q';break;
case 17:x='R';break;
case 18:x='S';break;
case 19:x='T';break;
case 20:x='U';break;
case 21:x='V';break;
case 22:x='W';break;
case 23:x='X';break;
case 24:x='Y';break;
case 25:x='Z';break;
}
return x;
}
|
2 | 687 |
int main()
{
int n;
int i, j;
int book_number[26];
int max = 0;
int max_n;
int author_len;
struct data
{
int number;
char author[27];
};
scanf("%d", &n);
struct data *input = (struct data*) malloc(sizeof(struct data) * n);
for(j = 0; j <= 25; j++)
book_number[j] = 0;
for(i = 0; i <= n - 1; i++)
{
scanf("%d %s", &input[i].number, input[i].author);
author_len = strlen(input[i].author);
for(j = 0; j <= author_len - 1; j++)
book_number[input[i].author[j] - 'A']++;
}
for(j = 0; j <= 25; j++)
{
if(book_number[j] > max)
{
max = book_number[j];
max_n = j;
}
}
printf("%c\n%d\n", max_n + 'A', max);
for(i = 0; i <= n - 1; i++)
{
author_len = strlen(input[i].author);
for(j = 0; j <= author_len - 1; j++)
{
if(input[i].author[j] == max_n + 'A')
{
printf("%d\n", input[i].number);
break;
}
}
}
free(input);
return 0;
}
|
2 | 688 | void main()
{char c;
int max=0,store,m,i,x[26][1000]={0},coun[27]={0},flag;
scanf("%d", &m);
for (i=1;i<=m;i++)
{scanf("%d ", &store);
for (;;)
{scanf("%c", &c);
if (c<65||c>90)
break;
else {x[c-64][i]=store;coun[c-64]++;}}
}
for (i=1;i<=26;i++)
{if (coun[i]>max)
{max=coun[i];
flag=i+64;
}
}
printf("%c\n", flag);
printf("%d\n", coun[flag-64]);
for (i=1;i<=1000;i++)
{if (x[flag-64][i]!=0)
printf("%d\n", x[flag-64][i]);
}
} |
2 | 689 | int main(int argc, char* argv[])
{
int m,i,j=0,zhe[26],t=0,x,name;
for(i=0;i<26;i++)
{
zhe[i]=0;
}
char s[26];
scanf("%d",&m);
struct
{
int num;
char s[26];
}shu[1000];
for(i=0;i<m;i++)
{
scanf("%d%s",&shu[i].num,shu[i].s);
}
for(i=0;i<m;i++)
{
for(j=0;shu[i].s[j]!=0;j++)
{
switch(shu[i].s[j])
{
case 'A':zhe[0]++;break;
case 'B':zhe[1]++;break;
case 'C':zhe[2]++;break;
case 'D':zhe[3]++;break;
case 'E':zhe[4]++;break;
case 'F':zhe[5]++;break;
case 'G':zhe[6]++;break;
case 'H':zhe[7]++;break;
case 'I':zhe[8]++;break;
case 'J':zhe[9]++;break;
case 'K':zhe[10]++;break;
case 'L':zhe[11]++;break;
case 'M':zhe[12]++;break;
case 'N':zhe[13]++;break;
case 'O':zhe[14]++;break;
case 'P':zhe[15]++;break;
case 'Q':zhe[16]++;break;
case 'R':zhe[17]++;break;
case 'S':zhe[18]++;break;
case 'T':zhe[19]++;break;
case 'U':zhe[20]++;break;
case 'V':zhe[21]++;break;
case 'W':zhe[22]++;break;
case 'X':zhe[23]++;break;
case 'Y':zhe[24]++;break;
case 'Z':zhe[25]++;break;
}
}
}
for(j=0;j<26;j++)
{
if(zhe[j]>t)
{
t=zhe[j];
x=j;
}
}
name='A'+x;
printf("%c\n",name);
printf("%d\n",t);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(shu[i].s[j]==name)
printf("%d\n",shu[i].num);
}
}
return 0;
} |
2 | 690 | struct information
{
int a;
char s[26];
int len;
}xinxi[1000];
void main()
{
int n,i,c[26]={0},max,t,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&xinxi[i].a,xinxi[i].s);
xinxi[i].len=strlen(xinxi[i].s) ;
}
for(i=0;i<n;i++)
for(j=0;j<xinxi[i].len;j++)
{
if(xinxi[i].s[j]=='A') c[1]++;
if(xinxi[i].s[j]=='B') c[2]++;
if(xinxi[i].s[j]=='C') c[3]++;
if(xinxi[i].s[j]=='D') c[4]++;
if(xinxi[i].s[j]=='E') c[5]++;
if(xinxi[i].s[j]=='F') c[6]++;
if(xinxi[i].s[j]=='G') c[7]++;
if(xinxi[i].s[j]=='H') c[8]++;
if(xinxi[i].s[j]=='I') c[9]++;
if(xinxi[i].s[j]=='J') c[10]++;
if(xinxi[i].s[j]=='K') c[11]++;
if(xinxi[i].s[j]=='L') c[12]++;
if(xinxi[i].s[j]=='M') c[13]++;
if(xinxi[i].s[j]=='N') c[14]++;
if(xinxi[i].s[j]=='O') c[15]++;
if(xinxi[i].s[j]=='P') c[16]++;
if(xinxi[i].s[j]=='Q') c[17]++;
if(xinxi[i].s[j]=='R') c[18]++;
if(xinxi[i].s[j]=='S') c[19]++;
if(xinxi[i].s[j]=='T') c[20]++;
if(xinxi[i].s[j]=='U') c[21]++;
if(xinxi[i].s[j]=='V') c[22]++;
if(xinxi[i].s[j]=='W') c[23]++;
if(xinxi[i].s[j]=='X') c[24]++;
if(xinxi[i].s[j]=='Y') c[25]++;
if(xinxi[i].s[j]=='Z') c[26]++;
}
max=c[0];
t=0;
for(i=1;i<26;i++)
{
if(c[i]>max)
{
max=c[i];
t=i;
}
}
printf("%c\n",64+t);
printf("%d\n",c[t]);
for(i=0;i<n;i++)
for(j=0;j<xinxi[i].len;j++)
if(xinxi[i].s[j]==64+t)
printf("%d\n",xinxi[i].a);
}
|
2 | 691 |
int main()
{
char mname[999][26], name;
int i, j, m, len, max = 0;
int num[999], count[26] = {0};
cin >> m;
for (i = 0; i < m; i++)
{
cin >> num[i] >> mname[i];
len = strlen(mname[i]);
for (j = 0; j < len; j++)
{
count[mname[i][j] - 'A']++;
}
}
for (i = 0; i < 26; i++)
{
if (count[i] > max)
{
max = count[i];
name = i + 'A';
}
}
cout << name << endl << max << endl;
for (i = 0; i < m; i++)
{
len = strlen(mname[i]);
for (j = 0; j < len; j++)
{
if (mname[i][j] == name)
{
cout << num[i] << endl;
break;
}
}
}
return 0;
}
|
2 | 692 | int main()
{
int number[1001],num[27]={0},ascii[27];
char a[1001][27],p;
int i,j,m,n,t1,t;
cin>>m;
n=26;
for(i=0;i<m;i++)
{
cin>>number[i];
cin>>a[i];
for(j=0;j<strlen(a[i]);j++)
{
num[a[i][j]-'A']++;
}
}
for(i=0;i<n;i++)
{
ascii[i]=i;
}
for(i=0;i<n;i++)
{
for(j=n-1;j>0;j--)
{
if(num[j]>num[j-1])
{
t=num[j];
num[j]=num[j-1];
num[j-1]=t;
t1=ascii[j];
ascii[j]=ascii[j-1];
ascii[j-1]=t1;
}
}
}
p='A'+ascii[0];
cout<<p<<endl;
cout<<num[0]<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<strlen(a[i]);j++)
{
if(a[i][j]==p)
{
cout<<number[i]<<endl;
break;
}
}
}
return 0;
}
|
2 | 693 |
struct book
{
int number;
char a[26];
int la;
struct book *next;
};
struct book *insert(struct book *head,struct book *temp)
{
struct book *p0,*p1,*p2;
p1=head;
p0=temp;
if(head==NULL)
{head=p0;p0->next=NULL;}
else
{
while(p1->next!=NULL)
{p1=p1->next;}
p1->next=p0;
p0->next=NULL;
}
return head;
}
void main()
{
struct book *p,*temp,*head=NULL;
int i,m,max;
int b[26]={0};
char writer;
scanf("%d",&m);
for(i=0;i<m;i++)
{
temp=(struct book *)malloc(sizeof(struct book));
scanf("%d ",&temp->number);
gets(temp->a);
temp->la=strlen(temp->a);
temp->next=NULL;
head=insert(head,temp);
}
p=head;
while(p!=NULL)
{
for(i=0;i<p->la;i++)
b[p->a[i]-65]++;
p=p->next;
}
max=b[0];writer=65;
for(i=0;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
writer=i+65;
}
}
printf("%c\n%d\n",writer,max);
p=head;
while(p!=NULL)
{
for(i=0;i<p->la;i++)
if(p->a[i]==writer)
{printf("%d\n",p->number);break;}
p=p->next;
}
} |
2 | 694 | int main()
{ struct s
{int N;
char w[26];
};
struct s s[999];
int n,i,j,c,a[26];
scanf("%d\n",&n);
for (i=0;i<=(n-1);i++)
{ scanf("%d",&s[i].N);
gets(s[i].w);
}
for (i=0;i<=(n-1);i++)
{ for (j=0;j<=25;j++)
{ c=s[i].w[j];
a[c-65]++;
}
}
c=0;
for (i=0;i<=25;i++)
{ if (a[c]<a[i]) c=i;
}
printf("%c\n%d\n",c+65,a[c]);
for (i=0;i<=(n-1);i++)
{ for (j=0;j<=25;j++)
if (s[i].w[j]==(c+65)) printf("%d\n",s[i].N);
}
} |
2 | 695 | struct book
{
int num;
char zz[32];
struct book *next;
};
struct book *creat(int n)
{
struct book *head,*p1,*p2;
int i;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->zz);
head=NULL;
for(i=0;i<n-1;i++)
{
if(i==0) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->zz);
}
p2->next=p1;
p1->next=NULL;
return (head);
}
void search(struct book *head,int n)
{
int *p[26],i,j;
struct book *q=head;
for(i=0;i<26;i++)
{
p[i]=(int *)malloc(sizeof(int));
*p[i]=0;
}
for(i=0;i<n;i++)
{
for(j=0;(q->zz)[j]!='\0';j++)
{
(*p[(q->zz)[j]-'A'])++;
}
q=q->next;
}
q=head;
int max=*p[0],k=0;
for(i=1;i<26;i++)
{if(*p[i]>max){max=*p[i];k=i;}}
printf("%c\n%d",'A'+k,max);
for(i=0;i<n;i++)
{
for(j=0;(q->zz)[j]!='\0';j++)
{
if((q->zz)[j]=='A'+k)
printf("\n%d",q->num);
}
q=q->next;
}
}
void main()
{
int n;
scanf("%d",&n);
struct book *head;
head=creat(n);
search(head,n);
} |
2 | 696 | int main()
{char ma='A';
int cnt[128]={0};
int i,j,n;
struct s
{int id;
char au[27];
}bk[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%s",&bk[i].id,bk[i].au);
for(j=0;bk[i].au[j]!='\0';j++)
{cnt[bk[i].au[j]]++;
if(cnt[bk[i].au[j]]>cnt[ma]){ma=bk[i].au[j];}
}
}
printf("%c\n%d\n",ma,cnt[ma]);
for(i=0;i<n;i++)
{
if(strchr(bk[i].au,ma)){printf("%d\n",bk[i].id);}
}
return 0;
} |
2 | 697 | struct cs
{
int b;
char a[26];
};
int main()
{
int m,i,j,k,max=0;
int c[200][1000],count[200]={0};
struct cs x[1000];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&x[i].b);
gets(x[i].a);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(x[i].a);j++)
{
for(k=65;k<91;k++)
{
if(x[i].a[j]==k)
{count[k]++;
c[k][count[k]]=x[i].b;
}
}
}
}
for(k=65;k<91;k++)
{
if(count[k]>max)
max=count[k];
}
for(k=65;k<91;k++)
{
if(count[k]==max)
{
printf("%c\n%d\n",k,count[k]);
for(j=1;j<=max;j++)
{
printf("%d\n",c[k][j]);
}
}
}
return 0;
} |
2 | 698 |
int main()
{
int n,i,j,max=0;
int zuozhe[26]={0};
char maxer;
struct book
{
int num;
char author[26];
}
shu[1000];
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %s",&shu[i].num,shu[i].author);
for (j=0;j<26;j++)
zuozhe[shu[i].author[j]-65]++;
}
for (j=0;j<26;j++)
if (zuozhe[j]>max)
{
max=zuozhe[j];
maxer=j+65;
}
printf("%c\n%d\n",maxer,max);
for (i=0;i<n;i++)
for (j=0;j<26;j++)
if (shu[i].author[j]==maxer)
{
printf("%d\n",shu[i].num);
continue;
}
}
|
2 | 699 | struct book{
int num;
char aut[20];
};
void main()
{
int i,j,n,t,max=0;
char a[20];
int words[26]={0};
struct book b[100];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d%s",&(b[i].num),&(b[i].aut));
for(i=0;i<n;i++)
for(j=0;b[i].aut[j]!='\0';j++){
t=(int)b[i].aut[j]-65;
words[t]++;
}
for(i=0;i<26;i++)
if(words[i]>max) { max=words[i];t=i;}
printf("%c\n%d\n",t+65,max);
for(i=0;i<n;i++)
for(j=0;b[i].aut[j]!='\0';j++)
if(b[i].aut[j]==(char)(t+65))
printf("%d\n",b[i].num);
}
|