id
int32 0
32.5k
| code
stringlengths 95
8.4k
| label
stringclasses 65
values |
---|---|---|
900 |
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 |
901 | int main()
{
int n;
scanf("%d",&n);
int a[1000]={0},b[1000]={0},c[100]={0},l=0;
char s[1000][100]={0},m[26]={0},p;
int i=0,j=0,k=0,t=0;
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i],s[i]);
}
for(i='A';i<='Z';i++)
{
m[j]=i;
for(t=0;t<n;t++)
{
for(k=0;s[t][k]!='\0';k++)
{
if(s[t][k]==m[j])
{
c[j]++;
break;
}
}
}
j++;
}
l=0;
for(i=0;i<26;i++)
{
if(c[i]>l)
{
l=c[i];
p=m[i];
}
}
printf("%c\n",p);
printf("%d\n",l);
for(i=0;i<n;i++)
{
k=0;
for(j=0;s[i][j]!='\0';j++)
{
if(s[i][j]==p)
{
k=1;
break;
}
}
if(k==1)
{
printf("%d\n",a[i]);
}
}
return 0;
} | 2 |
902 | struct book
{ int id;
char aut[26];
};
int main()
{
int m,n,i,j,k;
int a[27]={0};
struct book cal[1001];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d%s",&cal[i].id,cal[i].aut);
}
for(j=65;j<91;j++)
{ for(i=0;i<m;i++)
{ for(k=0;k<27;k++)
{ if(cal[i].aut[k]==j)
a[j-65]++;
}
}
}
int max=0,t;
for(i=0;i<26;i++)
{
if(a[i]>max)
{ max=a[i];
t=i;
}
}
printf("%c\n%d\n",t+65,max);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(cal[i].aut[j]==t+65)
printf("%d\n",cal[i].id);
}
}
return 0;
} | 2 |
903 | struct tushu{
int bianhao;
char writer[27];
}book[1000];
void jishu(struct tushu *p1,int a[26],int b);
int max(int c[26]);
void shu(struct tushu *p2,int d,int e);
int main(){
int n,i,m;
int zimu[26];
struct tushu *pointer;
pointer=&book[0];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&book[i].bianhao,&book[i].writer);
}
jishu(pointer,zimu,n);
m=max(zimu);
shu(pointer,m,n);
return 0;
}
void jishu(struct tushu *p1,int a[26],int b){
int j,k,diji;
for(j=0;j<26;j++){
a[j]=0;
}
for(j=0;j<b;j++){
k=0;
do{
diji=(*(p1+j)).writer[k]-'A';
a[diji]++;
k++;
}while((*(p1+j)).writer[k]!='\0');
}
}
int max(int c[26]){
int k,da,jieguo=0;
da=c[0];
for(k=1;k<26;k++){
if(c[k]>da){
da=c[k];
jieguo=k;
}
}
printf("%c\n%d\n",65+jieguo,da);
return(jieguo);
}
void shu(struct tushu *p2,int d,int e){
char ai=65+d;
int x,y;
for(x=0;x<e;x++){
y=0;
do{
if((*(p2+x)).writer[y]==ai){
printf("%d\n",(p2+x)->bianhao);
}
y++;
}while((*(p2+x)).writer[y]!='\0');
}
}
| 2 |
904 | int main(){
int n,i,j,max=0,b[1000],p[26];
char *bm[1000];
scanf("%d",&n);
for(i=0;i<26;i++)
p[i]=0;
for(i=0;i<n;i++){
scanf("%d",&b[i]);
bm[i]=(char *)malloc(26*sizeof(char));
scanf("%s",bm[i]);
for(j=0;j<strlen(bm[i]);j++){
p[(int)(*(bm[i]+j)-'A')]++;
}
}
for(i=0;i<26;i++){
if(p[i]>p[max])
max=i;
}
printf("%c\n",(char)('A'+max));
printf("%d\n",p[max]);
for(i=0;i<n;i++){
for(j=0;j<strlen(bm[i]);j++){
if(bm[i][j]==(char)('A'+max)){
printf("%d\n",b[i]); break;
}
}
}
return 1;
} | 2 |
905 | 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 |
906 | 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);
}
| 2 |
907 | 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 |
908 |
struct book{
int num;
char author[27];
};
int main()
{
int n,m,i,j;
int author_num[26]={0};
scanf("%d",&n);
struct book shu[999];
for(i=0;i<n;i++){
scanf("%d%s",&shu[i].num,shu[i].author);
}
for(i=0;i<n;i++){
for(j=0;j<26;j++){
m=shu[i].author[j]-'A';
author_num[m]++;
}
}
int max=author_num[0],author='A';
for(i=1;i<26;i++){
if(author_num[i]>max){
max=author_num[i];
author=i+'A';
}
}
printf("%c\n%d\n",author,max);
for(i=0;i<n;i++){
for(j=0;j<26;j++){
if(shu[i].author[j]==author){
printf("%d\n",shu[i].num);
}
}
}
return 0;
}
| 2 |
909 | 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 |
910 | struct book
{
int num;
char name[20];
struct book *next;
};
int i,j,n,t,number[100],m;
struct book *creat(void)
{
struct book *p1,*p2,*head;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
for(i=1;i<m;i++)
{
if(i==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p2=p1;
p2->next=NULL;
return(head);
}
void main()
{
scanf("%d",&m);
struct book *creat(void);
struct book *head,*p;
int a[26]={0},max,maxindex=0;
head=p=creat();
char *pointer;
do
{
for(pointer=p->name;*pointer!='\0';pointer++)
{
for(i=0;i<26;i++)
{
if(*pointer==65+i)
a[i]++;
}
}
p=p->next;
}while(p!=NULL);
max=a[0];
for(i=1;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
maxindex=i;
}
}
printf("%c\n%d\n",65+maxindex,a[maxindex]);
p=head;
do
{
for(pointer=p->name;*pointer!='\0';pointer++)
{
if(*pointer==65+maxindex)
printf("%d\n",p->num);
}
p=p->next;
}while(p!=NULL);
} | 2 |
911 |
int main()
{
int m;
struct bo
{int a;
char au[36];
};
struct bo bo[999];
int i,j;
char k,K;
int sb[26]={0},sbt;
int len;
int n;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %s",&bo[i].a,bo[i].au);
len=strlen(bo[i].au);
for(j=0;j<len;j++){
for(k=65;k<91;k++){
if(bo[i].au[j]==k){
sb[k-65]++;
}
}
}
}
K=0;
sbt=0;
for(i=0;i<26;i++){
if(sb[i]>sbt){
K=i+65;
sbt=sb[i];
}
}
printf("%c\n%d\n",K,sbt);
for(i=0;i<m;i++){
n=1;
for(j=0;j<strlen(bo[i].au);j++){
if(K==bo[i].au[j]){
n=0;
}
}
if(n==0){
printf("%d\n",bo[i].a);
}
}
} | 2 |
912 | int max,n,x,b[30]={0};
struct book
{
int num;
char author[30];
struct book*next;
};
struct book*creat()
{
struct book*head,*p1,*p2;
p2=NULL;
head=(struct book*)malloc(len);
p1=head;
while(n>0)
{
char a[30];int i,j;
p2=p1;
x=0;
scanf("%d%s",&p1->num,&p1->author);
strcpy(a,p1->author);
max=b[0];
for(i=0;a[i]!='\0';i++)
{
for(j='A';j<='Z';j++)
{
if(j==a[i])
b[j]++;
}
}
for(j='A';j<='Z';j++)
{
if(b[j]>max)
{
max=b[j];
x=j;
}
}
p1=(struct book*)malloc(len);
p2->next=p1;
n--;
}
p2->next=NULL;
printf("%c\n%d\n",x,max);
return head;
}
struct book*print(struct book*head,char x)
{
struct book*p1;
p1=head;
int i;
while(p1!=NULL)
{
char a[30];
strcpy(a,p1->author);
for(i=0;a[i]!='\0';i++)
{
if(a[i]==x)
printf("%d\n",p1->num);
}
p1=p1->next;
}
return head;
}
void main()
{
scanf("%d",&n);
struct book*head;
head=creat();
print(head,x);
}
| 2 |
913 |
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 |
914 |
int num[1000];
char auth[1000][26];
int main()
{
int m,i,l;
scanf("%d",&m);
char c='A';
int k=0;
int a[26];
for(i=0;i<26;i++)
a[i]=0;
for (i=0;i<m;i++)
{
scanf("%d",&num[i]);
scanf("%s",auth[i]);
int j=0;
while(auth[i][j]!='\0')
{
a[auth[i][j]-64]++;
j++;
}
}
for(i=0;i<25;i++)
{
if (a[i]>k)
{
k=a[i];
c=i+64;
}
}
printf("%c\n%d\n",c,k);
for(i=0;i<m;i++)
for(l=0;l<26;l++)
{
if(auth[i][l]==c)
printf("%d\n",num[i]);
}
return 0;
} | 2 |
915 | int m;
struct book
{
char num[20];
char aut[20];
struct book*next;
};
struct book*creat()
{
struct book*head,*p1,*p2;
int i;
p1=(struct book*)malloc(LEN);
scanf("%s %s",p1->num,p1->aut);
p1->next=NULL;
head=p1;
p2=p1;
for(i=1;i<m;i++)
{
p1=(struct book*)malloc(LEN);
scanf("%s %s",p1->num,p1->aut);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
return(head);
}
void print(struct book*head)
{
struct book*p;
int*tem,i,k;
char*q,max,c;
tem=(int*)malloc(30*sizeof(int));
for(i=0;i<30;i++)
{
*(tem+i)=0;
}
for(p=head;p;p=p->next)
{
q=p->aut;
for(i=0;*(q+i)!='\0';i++)
{
c=*(q+i)-'A';
*(tem+c)+=1;
}
}
max=0;
k=0;
for(i=0;i<26;i++)
{
if(*(tem+i)>max)
{
max=*(tem+i);
k=i;
}
}
c=k+'A';
printf("%c\n",c);
printf("%d\n",max);
for(p=head;p;p=p->next)
{
for(q=p->aut,i=0;*(q+i)!='\0';i++)
{
if(*(q+i)==c)
{
break;
}
}
if(*(q+i)!='\0')
{
printf("%s\n",p->num);
}
}
}
int main()
{
struct book*head;
scanf("%d",&m);
head=creat();
print(head);
}
| 2 |
916 |
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 |
917 | struct book
{
int num;
char author[27];
struct book *next;
};
void main()
{
int m,i,j,k,a[26],sum=0;
for(j=0;j<26;j++)
a[j]=0;
char aut;
scanf("%d",&m);
struct book *head,*pb1,*pb2;
head=NULL;
for(i=0;i<m;i++)
{
pb1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&pb1->num,pb1->author);
for(j=0;pb1->author[j]!='\0';j++)
{
k=pb1->author[j]-'A';
a[k]+=1;
}
if(head==NULL) {head=pb1;pb2=pb1;pb2->next=NULL;}
else
{
pb2->next=pb1;pb2=pb1;pb2->next=NULL;
}
}
for(j=0;j<26;j++)
{if(a[j]>sum) {sum=a[j],k=j;}
}
aut=(char)('A'+k);
printf("%c\n",aut);
printf("%d\n",sum);
pb1=head;
while(pb1)
{
for(j=0;pb1->author[j]!='\0';j++)
if(pb1->author[j]==aut) printf("%d\n",pb1->num);
pb1=pb1->next;
}
}
| 2 |
918 | struct tushu
{
int num;
char name[26];
struct tushu *next;
};
struct tushu *creat(int n)
{
struct tushu *head,*p1,*p2;
p1=p2=(struct tushu *)malloc(LEN);
scanf("%d%s",&p1->num,p1->name);
head=p1;
int i;
for(i=1;i<n;i++)
{
p1=(struct tushu *)malloc(LEN);
scanf("%d%s",&p1->num,p1->name);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return(head);
}
int main()
{
int n,num[26]={0},*p,i,j,max=0;
char *a;
scanf("%d",&n);
struct tushu *head,*p1;
head=creat(n);
p=num;
for(i=0;i<26;i++)
{
p1=head;
a=p1->name;
while(p1!=NULL)
{
for(j=0;*(a+j)!='\0';j++)
{
if(*(a+j)==i+65)
{
*(p+i)=*(p+i)+1;
break;
}
}
p1=p1->next;
a=p1->name;
}
}
for(i=1;i<26;i++)
{
if(*(p+max)<*(p+i)) max=i;
}
printf("%c\n",max+65);
printf("%d\n",*(p+max));
p1=head;
a=p1->name;
while(p1!=NULL)
{
for(i=0;*(a+i)!='\0';i++)
{
if(*(a+i)==(max+65))
{
printf("%d\n",p1->num);
break;
}
}
p1=p1->next;
a=p1->name;
}
return 0;
}
| 2 |
919 |
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 |
920 | struct a{
int n;
char s[26];
}b[1000];
int main()
{
int n,i,j,c[26]={0};
char t;
scanf("%d",&n);
for (i=0;i<n;i++)
{
int d,m;
scanf("%d%s",&b[i].n,b[i].s);
d=strlen(b[i].s);
for(m=0;m<d;m++)
c[b[i].s[m]-65]+=1;
}
for(i=0;i<26;i++)
{
for(j=i+1;j<26;j++)
if(c[j]>c[i])
break;
if(j==26)
break;
}
t=65+i;
printf("%c\n%d\n",t,c[i]);
for(i=0;i<n;i++)
{
if(strchr(b[i].s,t)!=NULL)
printf("%d\n",b[i].n);
}
return 0;
} | 2 |
921 | int main()
{
char a[1000][27],x;
int m,i,j,k,b[1000],c[26]={0},max=0;
cin>>m;
for(i=0;i<m;i++)
{
cin>>b[i]>>a[i];
int len=strlen(a[i]);
for(j=0;j<len;j++)
c[a[i][j]-'A']++;
}
for(j=0;j<26;j++)
if(max<c[j])
{
max=c[j];
x='A'+j;
}
cout<<x<<endl;
cout<<max<<endl;
for(i=0;i<m;i++)
{
int len=strlen(a[i]);
for(k=0;k<len;k++)
if(a[i][k]==x)
{
cout<<b[i]<<endl;
break;
}
}
return 0;
}
| 2 |
922 | void main()
{
int a[999],m,i,j,c[26],max=0,d,k;
scanf("%d\n",&m);
for(k=0;k<26;k++)
{
c[k]=0;
}
struct books
{
int num;
char name[26];
}
books[999];
for(i=0;i<m;i++)
{
scanf("%d %s",&books[i].num,books[i].name);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
c[books[i].name[j]-'A']++;
}
}
for(k=0;k<26;k++)
{
if(c[k]>max)
{
max=c[k];
d=k;
}
}
printf("%c\n%d\n",d+'A',max);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
if(books[i].name[j]==d+'A')
{
printf("%d\n",books[i].num);
break;
}
}
}
} | 2 |
923 |
int main()
{int m, i, j, b[999], n[26], t[2]={0}, x=0;
char a[999][26], au;
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&b[i],a[i]);}
for(i=0;i<m;i++)
{
for(j=0;j<(int)strlen(a[i]);j++)
{n[(int)a[i][j]-65]++;}
}
for(i=0;i<26;i++)
{
if(t[0]<n[i])
{t[0]=n[i],t[1]=i;}
}
au=t[1]+65;
printf("%c\n%d\n",au,t[0]);
for(i=0;i<m;i++)
{
x=0,j=0;
while(j<(int)strlen(a[i])&&x==0)
{
if(a[i][j]==t[1]+65)
{printf("%d\n",b[i]),x++;}
else
{j++;}
}
}
return 0;
} | 2 |
924 | struct book
{
int num;
char name[26];
struct book *next;
};
struct book *creat(int n)
{
int i;
struct book *head;
struct book *p1,*p2;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
for(i=0;i<n-1;i++)
{
if(i==0)head=p1;
p1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return (head);
}
void main()
{
int i,n,a[26]={0},max=0,j,k=0;
char t;
struct book *p,*p1;
scanf("%d",&n);
p=creat(n);
p1=p;
for(j=0;j<n;j++)
{
for(i=0;*(p->name+i)!='\0';i++)
a[*(p->name+i)-65]=a[*(p->name+i)-65]+1;
p=p->next;
}
for(i=0;i<26;i++)
{
if(a[i]>max){max=a[i];k=i;}
}
printf("%c\n%d\n",(k+65),max);
t=(char)(k+65);
while(p1!=NULL)
{
for(i=0;*(p1->name+i)!='\0';i++)
{
if(*(p1->name+i)==t)
{
printf("%d\n",p1->num);
break;
}
}
p1=p1->next;
}
}
| 2 |
925 | 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 |
926 | void main()
{
struct book
{
int num;
char w[27];
};
struct book b[1000];
int n,i,j,k,c[26]={0},max;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&b[i].num,b[i].w);
}
for(i='A';i<='Z';i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<strlen(b[j].w);k++)
{
if(i==b[j].w[k])
{
c[i-65]++;
}
}
}
}
max=0;
for(i=1;i<26;i++)
{
if(c[i]>c[max])
max=i;
}
printf("%c\n",max+65);
printf("%d\n",c[max]);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(b[i].w);j++)
{
if(b[i].w[j]==max+65)
{
printf("%d\n",b[i].num);
break;
}
}
}
}
| 2 |
927 | 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 |
928 | int main ()
{
struct book
{
int num;
char name[27];
}b[1000];
int m,i,j,a=0;
int c[26];
scanf("%d",&m);
for (i=0;i<m;i++)
scanf("%d%s",&b[i].num,b[i].name);
for (i=0;i<m;i++)
{
for (j=0;j<strlen(b[i].name);j++)
c[*(b[i].name+j)-'A']++;
}
for (i=0;i<26;i++)
a=c[i]>c[a]?i:a;
printf("%c\n",a+'A');
printf("%d\n",c[a]);
for (i=0;i<m;i++)
{
for (j=0;j<strlen(b[i].name);j++)
{
if ( *(b[i].name+j)==('A'+a))
printf("%d\n",b[i].num);
}
}
return 0;
}
| 2 |
929 | struct author
{
int num;
char aut[27];
}a[999];
void main()
{
void search(struct author b[],int n,char marker);
int m ,i,times[30]={0};
int length=0,j;
int max=0,flag=9;
char chac;
scanf("%d",&m);
// printf("%d",m);
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i].num,&a[i].aut);
// printf("%d %s",a[i].num,a[i].aut);
length=strlen(a[i].aut);
for(j=0;j<length;j++)
{
chac=a[i].aut[j];
times[chac-'A']++;
}
}
for(i=0;i<26;i++)
{
if(max<times[i])
{
max=times[i];
flag=i;
}
}
printf("%c\n%d\n",(char)(flag+'A'),max);
search(a,m,(char)(flag+'A'));
}
void search(struct author b[],int n,char marker)
{
int i,j;
for (i=0;i<n;i++)
{
for(j=0;j<strlen(b[i].aut);j++)
{
if(b[i].aut[j]==marker)
printf("%d\n",b[i].num);
}
}
}
| 2 |
930 | struct book
{
int id;
char p[26];
};
void main()
{
int n,i,j,k,a[150]={0},flag,max=0;
struct book t,*s,o[1000],y[1000];
scanf("%d",&n);
s=(struct book *)malloc(n*sizeof(struct book));
for(i=0;i<n;i++)
{ scanf("%d %s",&s[i].id,s[i].p);
for (j=0;s[i].p[j]!='\0';j++)
a[s[i].p[j]]++;
}
for(i='A';i<='Z';i++)
if (max<a[i]) {max=a[i];j=i;}
printf("%c\n",j);
printf("%d\n",max);
for(i=0;i<n;i++)
{
flag=0;
for(k=0;s[i].p[k]!='\0';k++)
if (s[i].p[k]==j)flag=1;
if(flag==1) printf("%d\n",s[i].id);
}
} | 2 |
931 | struct a
{
int number;
char authors[26];
struct a*next;
};
int n,max=0;
int main()
{
struct a*create(void);
char sum(struct a*);
void pr(char x,struct a*head);
struct a*head;
char x;
scanf("%d",&n);
head=create();
x=sum(head);
pr(x,head);
}
struct a*create(void)
{
struct a*head,*p1,*p2;
int i;
p1=len;head=p1;p2=p1;
for(i=0;i<n;i++)
{
scanf("%d %s",&p1->number,p1->authors);
if(i!=n-1)
{p1=len;p2->next=p1;p2=p2->next;}
else p1->next=null;
}
return head;
}
char sum(struct a*head)
{
struct a*p;
p=head;
int a[26]={0},i,j;
char zd;
for(i=0;i<n;i++)
{
for(j=0;*(p->authors+j)!='\0';j++)
a[*(p->authors+j)-65]++;
p=p->next;
}
for(i=0;i<26;i++)
if(a[i]>max){max=a[i];zd=i;}
printf("%c\n%d",zd+65,a[zd]);
return(zd+65);
}
void pr(char x,struct a*head)
{
int i,j,num;
struct a*p;
p=head;
for(i=0;i<n;i++)
{
num=0;
for(j=0;*(p->authors+j)!='\0';j++)
if(*(p->authors+j)==x)num=1;
if(num)printf("\n%d",p->number);
p=p->next;
}
} | 2 |
932 | struct student
{
long num;
char str[27];
struct student *next;
};
int n;
struct student *creat(int m)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%ld %s",&p1->num,p1->str);
head=0;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%d %s",&p1->num,p1->str);
}
p2->next=0;
return(head);
}
void main()
{
struct student *head,*p,stu;
int m,i,t,max,y=1,a[100]={0},sum[27]={0};
char x=1,c;
scanf("%d",&m);
head=creat(m);
p=head;
for(;p!=0;p=p->next)
{
for(t=0;t<strlen(p->str);t++)
{
c=p->str[t];
sum[c-64]++;
}
}
max=sum[1];
for(i=1;i<=26;i++)
if(sum[i]>max){max=sum[i];x=i;}
for(p=head;p!=0;p=p->next)
{
for(t=0;t<=strlen(p->str);t++)
if(p->str[t]==x+64)a[y]=p->num;
y++;
}
printf("%c\n%d\n",x+64,max);
for(y=1;y<=99;y++)
if(a[y]!=0)printf("%d\n",a[y]);
}
| 2 |
933 | struct book
{
int name;
char writer[26];
};
void main()
{
struct book data[999];
int m,i,j,max=0,b=0;
int a[26]={0};
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&data[i].name,data[i].writer);
for(i=0;i<m;i++)
for(j=0;j<strlen(data[i].writer);j++)
a[data[i].writer[j]-'A']++;
for(i=0;i<26;i++)
if(a[i]>max)
{max=a[i];
b=i;}
printf("%c\n%d\n",('A'+b),max);
for(i=0;i<m;i++)
for(j=0;j<strlen(data[i].writer);j++)
{if(data[i].writer[j]==('A'+b))
{
printf("%d\n",data[i].name);
break;}
}
} | 2 |
934 | int main(){
int n,i,j,k,z;
char max;
int sum[999]={0};
struct student{
int a;
char b[26];
int c[26];
}x[999];
scanf("%d\n",&n);
for(i=0;i<n;i++){
scanf("%d ",&x[i].a);
for(j=0;;j++){
scanf("%c",&x[i].b[j]);
if(x[i].b[j]=='\n')
break;
x[i].c[x[i].b[j]-65]++;}
}
for(k=0;k<26;k++){
for(i=0;i<999;i++){
sum[k]=sum[k]+x[i].c[k];
}
}
z=sum[0];
max=65;
for(k=1;k<26;k++){
if(sum[k]>z){
max=k+65;
z=sum[k];
}
}
printf("%c\n",max);
printf("%d\n",z);
for(i=0;i<n;i++){
if(x[i].c[max-65]>0){
printf("%d\n",x[i].a);
}
}
scanf("%d",i);
return 0;}
| 2 |
935 | 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 |
936 |
int main(int argc, char* argv[])
{
int n,i,j,m,b=0,max;
int let[26]={0};
char a;
struct student{
int num;
char name[26];
}book[999];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%s",&book[i].num,&book[i].name);
}
for(i=0;i<n;i++){
m=strlen(book[i].name);
for(j=0;j<m;j++){
let[book[i].name[j]-'A']++;
}
}
max=let[0];
for(i=0;i<25;i++){
if(let[i]>max){
max=let[i];
b=i;
}
}
a=b+'A';
printf("%c\n%d\n",a,max);
for(i=0;i<n;i++){
m=strlen(book[i].name);
for(j=0;j<m;j++){
if(book[i].name[j]==a){
printf("%d\n",book[i].num);
}
}
}
return 0;
}
| 2 |
937 | struct book
{
int num;
char auth[26];
struct book *next;
};
struct book *creat(int m)
{
int i=0;
struct book *head,*p1,*p2;
if(i==0)
{
p1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->auth);
head=p1;
p2=p1;
p1->next=NULL;
i++;
}
while(i<m)
{
p1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->auth);
p2->next=p1;
p1->next=NULL;
p2=p1;
i++;
}
return (head);
}
int main()
{
int m,i,lenth;
int max=0,maxwh=27;
int count[26]={0};
struct book *head,*p;
scanf("%d",&m);
head=creat(m);
p=head;
while(p!=NULL)
{
lenth=strlen(p->auth);
for(i=0;i<lenth;i++)
count[(int)(p->auth)[i]-65]++;
p=p->next;
}
for(i=0;i<26;i++)
{
if(count[i]>max)
{
max=count[i];
maxwh=i;
}
}
printf("%c\n",maxwh+65);
printf("%d\n",max);
p=head;
while(p!=NULL)
{
lenth=strlen(p->auth);
for(i=0;i<lenth;i++)
{
if((int)(p->auth[i])==maxwh+65)
{
printf("%d\n",p->num);
break;
}
}
p=p->next;
}
return 0;
}
| 2 |
938 |
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 |
939 | int main()
{
int n,i,l,x,maxnumber;
scanf("%d",&n);
int a[1000];
char k[1000][30];
int author[27]={0};
for(i=1;i<=n;i++)
{
scanf("%d %s",&a[i],k[i]);
int m;
m=strlen(k[i]);
for(l=0;l<30;l++)
{
for(x=1;x<=26;x++)
{
if(k[i][l]==x+64)
author[x]++;
}
}
}
int max=0;
for(i=1;i<=26;i++)
{
if(author[i]>max)
max=author[i];
}
for(i=1;i<=26;i++)
{
if(author[i]==max)
maxnumber=i;
}
char who[10];
who[0]='A'+maxnumber-1 ;
printf("%c\n",who[0]);
printf("%d\n",max);
for(i=1;i<=n;i++)
{
for(l=0;l<=strlen(k[i]);l++)
if(k[i][l]==who[0])
printf("%d\n",a[i]);
}
return 0;
}
| 2 |
940 | int main()
{
char temp,s;
int i,j,t[27][2000],m,n,a[27] = {0},num[2000],x;
{
cin >> n;
for (i = 1; i <= n; i++ )
{
cin >> num[i];
temp = cin.get();
while (temp == '\n' || temp == ' ' )
{
temp = cin.get();
}
for (j = 1; 1; j++ )
{
x = temp - 'A' + 1;
t[x][a[x]] = num[i];
a[x]++;
temp = cin.get();
if (temp == '\n')
{
break;
}
}
}
m = 0;
for (i = 1; i <= 26; i++)
{
if (a[i] > a[m])
{
m = i;
}
}
s = m + 'A' - 1;
cout << s << endl << a[m] << endl;
for (i = 0; i < a[m]; i++)
{
cout << t[m][i] << endl;
}
}
} | 2 |
941 | 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 |
942 | void main()
{
int i,n,j,t,m,a[26]={0},book[999],max;
char writer[999][26],maxwriter;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i],writer[i]);
m=strlen(writer[i]);
for(j=0;j<m;j++)
{
t=writer[i][j]-'A';
a[t]++;
}
}
max=0;
maxwriter='A';
for(i=0;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
maxwriter='A'+i;
}
}
printf("%c\n%d\n",maxwriter,max);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(writer[i]);j++)
{
if(writer[i][j]==maxwriter)
{
printf("%d\n",book[i]);
break;
}
}
}
}
| 2 |
943 | struct A
{
char num[1000];
char B[27];
};
void main()
{
int n,i,a,k,t;
int sb[27]={0};
int sb2[27]={0};
char x;
scanf("%d",&n);
struct A book[999]={0};
for (i=0;i<n;i++)
{
scanf("%s%s",book[i].num,book[i].B);
}
for(i=0;i<n;i++)
{
for(k=0; ;k++)
{
a=book[i].B[k];
if (book[i].B[k]<='Z'&&book[i].B[k]>='A')
{
sb[a-64]++;
}
else break;
}
}
for(i=1;i<=26;i++)
{
sb2[i]=sb[i];
}
for (i=1;i<26;i++)
{
if(sb[i]>sb[i+1])
{
a=sb[i];
sb[i]=sb[i+1];
sb[i+1]=a;
}
}
for(i=1;i<=26;i++)
{
if (sb2[i]==sb[26])
{
t=i;
}
}
x='A'+t-1;
printf("%c\n%d\n",x,sb[26]);
for(i=0;i<n;i++)
{
for(k=0; ;k++)
{
if(book[i].B[k]=='\0')break;
else if (book[i].B[k]==x)
printf("%s\n",book[i].num);
}
}
}
| 2 |
944 | 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 |
945 | struct book
{
int num;
char name[27];
struct book *next;
};
struct book *creat(int n)
{
struct book *head,*p1,*p2;
int m=0;
head=p1=p2=NULL;
p1=p2=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
while(1)
{
m+=1;
if(m>=n)break;
if(m==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p2=p1;
p2->next=NULL;
return(head);
}
void main()
{
struct book *head,*p;
char maxchar;
int m,i=0,max=0,a[26]={0};
scanf("%d",&m);
head=creat(m);
for(p=head;p!=NULL;p=p->next)
{
//printf("%d,%s\n",p->num,p->name);
for(i=0;p->name[i]!='\0';i++)
{
int c=p->name[i]-'A';
a[c]++;
}
}
for(i=0;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
maxchar='A'+i;
}
}
printf("%c\n%d\n",maxchar,max);
for(p=head;p!=NULL;p=p->next)
for(i=0;p->name[i]!='\0';i++)
{
if(p->name[i]==maxchar)
{
printf("%d\n",p->num);
break;
}
}
}
| 2 |
946 | 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 |
947 | struct book
{
int num;
char aut[26];
};
int main()
{
int i,j,k,m,x,a=0;
int count[26]={0};
char y;
struct book all[1000];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d%s",&all[i].num,&all[i].aut);
}
for(i=0;i<m;i++){
for(j=0;j<26;j++){
if(all[i].aut[j]>='A'&&all[i].aut[j]<='Z'){
x=(int)(all[i].aut[j]-'A');
count[x]++;
}
}
}
for(i=0;i<26;i++){
if(count[i]>a){
a=count[i];
k=i;
}
}
y=k+'A';
printf("%c\n%d\n",y,a);
for(i=0;i<m;i++){
for(j=0;j<26;j++){
if(all[i].aut[j]==y){
printf("%d\n",all[i].num);
break;
}
}
}
return 0;
}
| 2 |
948 | int main()
{
int m,len[1000],sum[26]={0},max,i,j,i0;
scanf("%d",&m);
struct book{
int num;
char wri[27];
}book[1000];
for(i=0;i<m;i++){
scanf("%d %s",&book[i].num,book[i].wri);
len[i]=strlen(book[i].wri);
}
for(i=0;i<m;i++)
for(j=0;j<len[i];j++)
sum[book[i].wri[j]-65]++;
max=sum[0];
i0=0;
for(i=1;i<26;i++)
if(sum[i]>max){
max=sum[i];
i0=i;
}
printf("%c\n",i0+65);
printf("%d\n",max);
for(i=0;i<m;i++)
for(j=0;j<len[i];j++)
if(book[i].wri[j]==65+i0){
printf("%d\n",book[i].num);
break;
}
return 0;
} | 2 |
949 | int main()
{
struct book
{
int m;
char a[26];
};
int n,i,j,k,q=0;int b[26]={0},c[26];
scanf("%d",&n);
struct book * p;
p=(struct book *)malloc(n*sizeof(struct book));
for(i=0;i<n;i++)
scanf("%d %s",&p[i].m,p[i].a);
for(i=0;i<26;i++)
for(j=0;j<n;j++)
for(k=0;k<26;k++)
if(p[j].a[k]=='A'+i)
b[i]=b[i]+1;
for(i=0;i<26;i++)
c[i]=b[i];
for(j=0;j<25;j++)
for(i=0;i<25-j;i++)
if(b[i]>b[i+1])
{
k=b[i];
b[i]=b[i+1];
b[i+1]=k;
}
for(i=0;i<26;i++)
if(c[i]==b[25])
{
printf("%c\n%d\n",'A'+i,b[25]);
for(j=0;j<n;j++)
for(k=0;k<26;k++)
if(p[j].a[k]=='A'+i)
printf("%d\n",p[j].m);
}
free(p);
}
| 2 |
950 | int m;
struct book
{
int num;
char name[26];
struct book *next;
};
struct book *create(void)
{
struct book *head,*p1,*p2;
int i;
scanf("%d",&m);
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
for(i=1;i<m;i++)
{
if(i==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p1->next=NULL;
return(head);
}
void main()
{
int num[26]={0},i,j,max=0;
struct book *p1,*p2,*head;
char *p;
p1=create();
head=p1;
for(i=0;i<m;i++)
{
for(p=p1->name;*p!='\0';p++)
{
num[(*p)-'A']++;
}
p1=p1->next;
}
for(i=0;i<26;i++)
{
if(num[i]>max)
{
max=num[i];
j=i;
}
}
printf("%c\n",('A'+j));
printf("%d\n",max);
p1=head;
for(i=0;i<m;i++)
{
p=p1->name;
for(p=p1->name;*p!='\0';p++)
{
if(*p==('A'+j))
{
printf("%d\n",p1->num);
break;
}
}
p1=p1->next;
}
} | 2 |
951 | int main()
{
int m,i,j,k,max=-1;
int c[26];
char prname;
struct list
{
int num;
char writer[27];
int len;
}book[999];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&book[i].num);
gets(book[i].writer);
book[i].len=strlen(book[i].writer);
}
for(i=0;i<26;i++)
c[i]=0;
for(i=0;i<m;i++)
{
for(j=0;j<book[i].len;j++)
{
switch(book[i].writer[j])
{
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;
}
}
}
for(i=0;i<26;i++)
{
if(c[i]>max)
max=c[i];
else
continue;
}
for(i=0;i<26;i++)
{
if(c[i]!=max)
continue;
else
{
prname=i+65;
printf("%c\n",prname);
printf("%d\n",max);
for(j=0;j<m;j++)
{
for(k=0;k<book[j].len;k++)
{
if(book[j].writer[k]!=prname)
continue;
else
{
printf("%d\n",book[j].num);
break;
}
}
}
break;
}
}
return 0;
} | 2 |
952 | int main()
{
int A[100],C[26]={0},n,i,j,m,a=0,b;
char B[100][100],c;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d%s",&A[i],B[i]);
}
for (i=0;i<n;i++)
{
for (j=0;j<strlen(B[i]);j++)
{
m=B[i][j];
C[m-65]++;
}
}
for (i=0;i<26;i++)
{
if (a<C[i])
{
a=C[i];
b=i;
}
}
printf("%c\n",b+65);
printf("%d\n",a);
c=b+65;
for (i=0;i<n;i++)
{
for (j=0;j<strlen(B[i]);j++)
{
if (B[i][j]==c)
{
printf("%d\n",A[i]);
}
}
}
return 0;
}
| 2 |
953 |
struct info
{
int num;
char author[26];
} a[1000];
int main()
{
int i,m,j,b[26]={0};
char out;
scanf("%d\n",&m);
for(i=0;i<m;i++)
scanf("%d %s\n",&a[i].num,a[i].author);
for(i=0;i<m;i++)
for(j=0;j<26;j++)
b[a[i].author[j]-'A']++;
int max=b[0];
for(i=0;i<26;i++)
max=max>b[i]?max:b[i];
for(i=0;i<26;i++)
if(b[i]==max)
{
out='A'+i;
printf("%c\n",'A'+i);
printf("%d\n",b[i]);
break;
}
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(a[i].author[j]==out)
{
printf("%d\n",a[i].num);
break;
}
} | 2 |
954 | struct tushu
{
int num;
char name[20];
struct tushu *next;
};
struct tushu *creat(int m)
{
struct tushu *head,*p1,*p2;
p1=p2=(struct tushu *)malloc(LEN);
scanf("%d%s",&p1->num,p1->name);
head=p1;
int i;
for(i=2;i<=m;i++)
{
p1=(struct tushu *)malloc(LEN);
scanf("%d%s",&p1->num,p1->name);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return(head);
}
int main()
{
int m,num[26]={0},i,max;
scanf("%d",&m);
struct tushu *head,*p1;
head=creat(m);
char *x;
for(i=0;i<26;i++)
{
p1=head;
x=p1->name;
while(p1!=NULL)
{
while(*x!='\0')
{
if(*x==(i+65))
num[i]=num[i]+1;
x=x+1;
}
p1=p1->next;
x=p1->name;
}
}
max=0;
for(i=1;i<26;i++)
{
if(num[max]<num[i])
max=i;
}
printf("%c\n",max+65);
printf("%d\n",num[max]);
p1=head;
x=p1->name;
while(p1!=NULL)
{
while(*x!='\0')
{
if(*x==(max+65))
{
printf("%d\n",p1->num);
break;
}
x=x+1;
}
p1=p1->next;
x=p1->name;
}
return 0;
} | 2 |
955 |
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 |
956 | struct s
{
long h;//??????????
char z[1000];
struct s *next;
};
struct s *create(int n)
{
struct s *head,*p1,*p2;
int i=0;
p1=p2=(struct s *)malloc(len);
scanf("%ld %s",&p1->h,p1->z);//???????????????????
head=0;
while(i<n-1)//???????
{
i++;
if(i==1) head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct s *)malloc(len);
scanf("%ld %s",&p1->h,p1->z);
}
p2->next=p1;
p1->next=0;
return head;
}
void main()
{
int m,i,n,num[26]={0},j;
struct s *p1,*head;
char c,*p2;
scanf("%d",&n);
head=create(n);
p1=head;
for(i=0;i<n;i++)
{
for(p2=p1->z;*p2!='\0';p2++)
{
j=*p2-65;
num[j]++;
}
p1=p1->next;
}
m=num[0];
j=0;
for(i=0;i<26;i++)
{
if(num[i]>m)
{
m=num[i];
j=i;
}
}
c=j+65;
printf("%c\n",c);
printf("%d\n",num[j]);
p1=head;
for(i=0;i<n;i++)
{
for(p2=p1->z;*p2!='\0';p2++)
{
if(*p2==c)
{
printf("%ld\n",p1->h);
break;
}
}
p1=p1->next;
}
}
| 2 |
957 | struct book
{
char num[4];
char author[27];
}book[100];
int main()
{
int n,i,k,sz[26],t,m,e;
scanf("%d",&n);
m=0;
for(i=0;i<26;i++){
sz[i]=0;
}
for(i=0;i<n;i++){
scanf("%s%s",book[i].num,book[i].author);
t=strlen(book[i].author);
for(k=0;k<t;k++){
sz[book[i].author[k]-'A']++;
}
}for(i=0;i<26;i++){
if(sz[i]>m){
m=sz[i];
e=i;
}
}printf("%c\n%d\n",e+'A',m);
for(i=0;i<n;i++){
t=strlen(book[i].author);
for(k=0;k<t;k++){
if(book[i].author[k]==e+'A'){
printf("%s\n",book[i].num);
}
}
}return 0;
} | 2 |
958 | int main()
{
int i,j,k,l,m,n,g[26]={0},s[26][1000]={0};
char a[50];
scanf("%d",&n);
for(m=0;m<n;m++)
{for(i=0;i<50;i++)
a[i]=0;
scanf("%d%s",&l,a);
for(i=0;i<26;i++)
for(j=0;j<26;j++)
if(a[i]=='A'+j)
{s[j][g[j]]=l,g[j]++;
break;}}
m=0;
for(i=0;i<26;i++)
if(g[i]>m) m=g[i],k=i;
printf("%c\n%d\n",'A'+k,m);
for(i=0;i<m;i++)
printf("%d\n",s[k][i]);
} | 2 |
959 |
struct wr
{ char w;
int k;
int num[1000];
struct wr* next;
};
struct wr * creat(void)
{
struct wr *head,*p1,*p2,a;
char i;
head=p2=(struct wr *)malloc(sizeof(struct wr));
head->w='A';
head->k=0;
for(i='B';i<='Z';i++)
{
p1=(struct wr *)malloc(sizeof(struct wr));
p1->w=i;
p1->k=0;
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return head;
}
void add(char a,int b,struct wr * head)
{
struct wr *p;
for(p=head;p!=NULL;p=p->next)
if(a==p->w)
{(p->k)++;
*(p->num+p->k-1)=b;
}
}
void max(struct wr * head)
{
struct wr *p1,t;
for(p1=head->next;p1!=NULL;p1=p1->next)
if(p1->k>head->k)
*head=*p1;
}
void main()
{
struct wr *head,*t;
int n,*no,i;
char *ws,*p;
ws=(char *)malloc(sizeof(char)*27);
head=creat();
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&no);
gets(ws);
for(p=ws;*p!='\0';p++)
add(*p,no,head);
}
max(head);
printf("%c\n",head->w);
printf("%d\n",head->k);
for(i=0;i<head->k;i++)
printf("%d\n",*(head->num+i));
} | 2 |
960 |
int main()
{
int maxc=0,i,j,n,a[1000],c;
char maxp,b[1000][27],p;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&a[i],b[i]);
}
for (p='A';p<='Z';p++)
{
c=0;
for(i=0;i<n;i++)
{
for(j=0;;j++)
{
if(b[i][j]=='\0') break;
if(b[i][j]==p)
{
c++;
}
}
}
if(c>maxc)
{
maxc=c;
maxp=p;
}
}
printf("%c\n",maxp);
printf("%d\n",maxc);
for(i=0;i<n;i++)
{
for(j=0;;j++)
{
if(b[i][j]=='\0') break;
if(b[i][j]==maxp)
{
printf("%d\n",a[i]);
}
}
}
return 0;
}
| 2 |
961 | int main()
{
int n;char name[1000][26];int num[1000];
int i,j;char b[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'};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&num[i],name[i]);
}
int a[26]={0};char k;
for(i=0;i<n;i++)
{
for(j=0;(k=name[i][j]!='\0');j++)
{
if(name[i][j]=='A')
a[0]++;
if(name[i][j]=='B')
a[1]++;
if(name[i][j]=='C')
a[2]++;
if(name[i][j]=='D')
a[3]++;
if(name[i][j]=='E')
a[4]++;
if(name[i][j]=='F')
a[5]++;
if(name[i][j]=='G')
a[6]++;
if(name[i][j]=='H')
a[7]++;
if(name[i][j]=='I')
a[8]++;
if(name[i][j]=='J')
a[9]++;
if(name[i][j]=='K')
a[10]++;
if(name[i][j]=='L')
a[11]++;
if(name[i][j]=='M')
a[12]++;
if(name[i][j]=='N')
a[13]++;
if(name[i][j]=='O')
a[14]++;
if(name[i][j]=='P')
a[15]++;
if(name[i][j]=='Q')
a[16]++;
if(name[i][j]=='R')
a[17]++;
if(name[i][j]=='S')
a[18]++;
if(name[i][j]=='T')
a[19]++;
if(name[i][j]=='U')
a[20]++;
if(name[i][j]=='V')
a[21]++;
if(name[i][j]=='W')
a[22]++;
if(name[i][j]=='X')
a[23]++;
if(name[i][j]=='Y')
a[24]++;
if(name[i][j]=='Z')
a[25]++;
}
}
int max=a[0];int o=0;
for(i=0;i<26;i++)
{
if(a[i]>max)
{max=a[i];o=i;}
}
printf("%c\n%d\n",b[o],a[o]);
for(i=0;i<n;i++)
{
for(j=0;(k=name[i][j]!='\0');j++)
{
if(name[i][j]==b[o])
printf("%d\n",num[i]);
}
}
scanf("%d",&i);
return 0;
} | 2 |
962 | struct book
{
int num;
char writer[27];
struct book *next;
}*head;
int times[26];
void create(int m)
{
struct book *p1,*p2;
int i;
for (i=0;i<=m-1;i++)
{
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d",&p1->num);
scanf("%s",p1->writer);
if (!i) head=p1;
else p2->next=p1;
p2=p1;
}
p2->next=NULL;
}
int count()
{
int max,l,i;
char temp[27];
struct book *p1;
for (i=0;i<=25;i++) times[i]=0;
p1=head;
while (p1!=NULL)
{
l=strlen(p1->writer);
strcpy(temp,p1->writer);
for (i=0;i<=l-1;i++)
times[temp[i]-65]++;
p1=p1->next;
}
max=0;
for (i=0;i<=25;i++)
if (times[i]>times[max]) max=i;
return(max);
}
void print(int max)
{
struct book *p1;
int abc[999],total,l,i;
char temp[27];
total=0;
printf("%c\n",max+65);
p1=head;
while (p1!=NULL)
{
strcpy(temp,p1->writer);
l=strlen(temp);
for (i=0;i<=l-1;i++)
if (max+65==temp[i]) break;
if (i<l)
{
abc[total]=p1->num;
total++;
}
p1=p1->next;
}
printf("%d\n",total);
for (i=0;i<=total-1;i++)
{
printf("%d\n",abc[i]);
}
}
void main()
{
int max,m;
scanf("%d",&m);
create(m);
max=count();
print(max);
} | 2 |
963 | void main()
{
char name[30]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"},c[1000][100];
int n,a[1000],num[100]={0},i,j,k,max=0,t;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d ",&a[i]);
scanf("%s",c[i]);
}
for (i=0;i<n;i++)
{
for (k=0;c[i][k]!='\0';k++)
{
for (j=0;name[j]!='\0';j++)
{
if (name[j]==c[i][k])
{
num[j]++;
}
}
}
}
for (i=0;name[i]!='\0';i++)
{
if (num[i]>max)
{
max=num[i];
k=i;
}
}
printf("%c\n%d\n",name[k],num[k]);
for (i=0;i<n;i++)
{
for (j=0;c[i][j]!='\0';j++)
{
if (c[i][j]==name[k])
{
printf("%d\n",a[i]);
break;
}
}
}
} | 2 |
964 | struct book
{
int num;
char aut[27];
struct book *next;
};
int n;
struct book *creat(int amount)
{
struct book *head;
struct book *p1,*p2;
n=0;
p1=(struct book *)malloc(sizeof(struct book));
p2=p1;
scanf("%d %s",&p1->num,p1->aut);
while(n<amount-1)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->aut);
}
p2->next=p1,p1->next=NULL;
return(head);
}
int main()
{
int amount,i,a[26]={0},max,maxn;
struct book *p,*headp;
char *auth,name[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V','W','X','Y','Z'};
scanf("%d",&amount);
p=creat(amount);
headp=p;
for(p=headp;p!=NULL;p=p->next)
{
for(auth=p->aut;*auth!='\0';auth++)
{
for(i=0;i<26;i++)
{
if(name[i]==*auth)break;
}
a[i]=a[i]+1;
}
}
for(i=0,max=a[0],maxn=0;i<26;i++)
{
if(a[i]>max)max=a[i],maxn=i;
}
printf("%c\n%d\n",name[maxn],max);
for(p=headp;p!=NULL;p=p->next)
{
for(auth=p->aut;*auth!='\0';auth++)
{
if(*auth==name[maxn])break;
}
if(*auth=='\0');
else printf("%d\n",p->num);
}
} | 2 |
965 |
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 |
966 | struct book
{
int id;
char s[L];
int len;
}b[M];
void fun(int count[L],char s[L],int len)
{
int i;
for(i=0;i<len;i++)
{
int m;
m=s[i]-'A';
count[m]++;
}
}
int judge(char s[L],int len,char name)
{
int i,answer=0;
for(i=0;i<len;i++)
{
if(s[i]==name)
{
answer=1;
break;
}
}
return answer;
}
int main()
{
int m,k,count[L]={0},i,j,max,num;
char name;
scanf("%d",&m);
for(k=0;k<m;k++)
{
scanf("%d%s",&b[k].id,b[k].s);
b[k].len=strlen(b[k].s);
fun(count,b[k].s,b[k].len);
}
max=count[0];
num=0;
for(j=1;j<L;j++)
{
if(count[j]>max)
{
max=count[j];
num=j;
}
}
name=num+65;
printf("%c\n",name);
printf("%d\n",max);
for(k=0;k<m;k++)
{
int answer=0;
answer=judge(b[k].s,b[k].len,name);
if(answer==1)
printf("%d\n",b[k].id);
}
return 0;
}
| 2 |
967 | void main()
{
struct b
{int n;
char a[26];
};
struct b b[999];
int m,k,i,j,c[26]={0},p=0,q=0;
char x;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&b[i].n,&b[i].a);
for(i=0;i<m;i++)
for(j=0;(x=b[i].a[j])!='\0'&&j<26;j++)
c[x-65]++;
k=c[0];
for(i=0;i<26;i++)
if(c[i]>k){k=c[i];p=i;}
printf("%c\n",p+65);
printf("%d\n",c[p]);
for(i=0;i<m;i++)
{q=0;
for(j=0;(x=b[i].a[j])!='\0'&&j<26;j++)
if(x==p+65)q=1;
if(q==1)printf("%d\n",b[i].n);
}
}
| 2 |
968 | int main()
{
int i,j,temp=26,n,p[27]={0};
struct {
int a;
char s[30];
}t[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&t[i].a,t[i].s);
for(j=0;j<strlen(t[i].s);j++)
{
p[t[i].s[j]-'A']++;
}
}
for(i=0;i<26;i++)
{
if(p[i]>p[temp])
temp=i;
}
printf("%c\n%d\n",temp+'A',p[temp]);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(t[i].s);j++)
{
if(t[i].s[j]==temp+'A')
{
printf("%d\n",t[i].a);
break;
}
}
}
return 0;
} | 2 |
969 |
struct book
{
int num;
char name[25];
}book[999];
void main()
{
int m,i,j,k,b,c,max=0,a[25]={0},q[25][999]={0},p=0;
scanf("%d",&m);
for (i=0;i<m;i++)
{
scanf("%d %s",&book[i].num,book[i].name);
b=strlen(book[i].name);
for(j=0;j<b;j++)
{
for(k=0;k<26;k++)
{
if (book[i].name[j]==k+65)
{
a[k]=a[k]+1;
q[k][i]=book[i].num;
}
}
}
}
for (i=0;i<25;i++)
{
if(a[i]>max)
{
max=a[i];
c=i;
}
}
printf("%c\n%d\n",c+65,max);
for (i=0;i<m;i++)
{
if(q[c][i]>0)
printf("%d\n",q[c][i]);
}
}
| 2 |
970 | 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 |
971 | int main()
{
char mo='A';
int a[ASC]={0};
int i,j,n;
struct
{ int num;
char wr[MAX_N+1];
}book[MAX_M];
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%s",&book[i].num,book[i].wr);
for(j=0;book[i].wr[j];j++)
{if(++a[book[i].wr[j]]>a[mo]) mo=book[i].wr[j];}
}
printf("%c\n%d\n",mo,a[mo]);
for(i=0;i<n;i++)
if(strchr(book[i].wr,mo)) printf("%d\n",book[i].num);
return 0;
}
| 2 |
972 | 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 |
973 | int main()
{
struct book
{
int num;
char writer[26];
}book[999];
int m,i,n,j,max;
char a[26],c[26];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&book[i].num,&book[i].writer);
}
for(i=0;i<26;i++)
{
a[i]=i+65;
c[i]=0;
}
for(i=0;i<26;i++)
{
for(j=0;j<m;j++)
{
for(n=0;n<26;n++)
{
if(a[i]==book[j].writer[n])
{
c[i]++;
}
}
}
}
max=0;
for(i=0;i<26;i++)
{
if(c[i]>c[max])
{
max=i;
}
}
printf("%c\n%d\n",a[max],c[max]);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(book[i].writer[j]==a[max])
{
printf("%d\n",book[i].num);
}
}
}
return 0;
} | 2 |
974 | 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 |
975 | void main()
{
int n,i,j,k,a[1000],max=0,t,p[26]={0};
char c[1000][27],d,l[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'};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i],c[i]);
for(i=0;i<n;i++)
for(j=0;j<strlen(c[i]);j++)
for(k=0;k<26;k++){
if(c[i][j]==l[k])
p[k]+=1;
}
for(k=0;k<26;k++)
if(p[k]>max){max=p[k];t=k;}
printf("%c\n%d\n",l[t],max);
for(i=0;i<n;i++)
for(j=0;j<strlen(c[i]);j++)
if(c[i][j]==l[t]){
printf("%d\n",a[i]);
break;}
}
| 2 |
976 | 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 |
977 |
int main()
{
int n, i,l,j,t,k[30][99],a[30],o,q,max=0,maxman;
for(i=0;i<30;i++)
a[i]=0;
char s[40];
scanf("%d", &n);
for(j=0; j<n; j++)
{
scanf("%d %s",&o,s);
l=strlen(s);
for(i=0; i<l; i++)
{
q = s[i]-'A';
a[q]++;
t=a[q];
k[q][t]=o;
}
}
for(i='A'-'A';i<='Z'-'A';i++)
{
if(a[i]>max)
{
// printf("%d,%d\n",a[i],i);
max = a[i];
maxman = i;
}
}
printf("%c\n%d\n",maxman+'A',max);
for(i=1;i<=max;i++)
printf("%d\n",k[maxman][i]);
return 0;
}
| 2 |
978 |
void main()
{
int m;
scanf("%d",&m);
int i,j,k,x,t;
struct book
{
int num;
char w[26];
}b[1000];
for(i=0;i<m;i++)
{
scanf("%d",&b[i].num);
scanf("%s",&b[i].w);
}
int c[26];
for(i=0;i<26;i++)c[i]=0;
for(i=0;i<26;i++)
{
for(j=0;j<m;j++)
{
for(k=0;k<26;k++)
{
if(b[j].w[k]!='\0'&&b[j].w[k]-i=='A')c[i]++;
}
}
}
int d[26];
for(i=0;i<26;i++)d[i]=c[i];
for(i=0;i<25;i++)
{
if(d[i]>d[i+1])
{
t=d[i];
d[i]=d[i+1];
d[i+1]=t;
}
}
for(i=0;i<26;i++)
{
if(c[i]==d[25])x=i;
}
printf("%c\n",'A'+x);
printf("%d\n",c[x]);
for(j=0;j<m;j++)
{
for(k=0;k<26;k++)
{
if(b[j].w[k]-x=='A')printf("%d\n",b[j].num);
}
}
}
| 2 |
979 | struct book
{
int num;
char name[27];
struct book *next;
};
int m;
struct book *head;
struct book *setup()
{ int t=0;
struct book *head,*p1,*p2;
head=p1=p2=(struct book *)malloc(sizeof (struct book));
scanf("%d %s",&p1->num,p1->name);
while(t<m)
{ t++;
p2->next=p1;
p2=p1;
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
}
p2->next=NULL;
return(head);
}
int k=0,max=0;
void found(struct book *p)
{ int i,j;
p=head;
int *pi;
pi=(int *)malloc(sizeof(int)*26);
for(i=0;i<26;i++) *(pi+i)=0;
for(i=0;i<m;i++)
{
for(j=0;p->name[j]!='\0';j++)
{
(*(pi+(p->name[j]-'A')))++;
}
p=p->next;
}
for(j=0;j<26;j++)
{
if(*(pi+j)>max){
max=*(pi+j);
k=j;
}
}
}
int main()
{ int i,j;
scanf("%d",&m);
struct book *p;
head=p=setup();
found(p);
printf("%c\n%d\n",(k+'A'),max);
p=head;
for(i=0;i<m;i++)
{for(j=0;p->name[j]!='\0';j++)
if(p->name[j]==k+'A'){
printf("%d\n",p->num);
break;
}
p=p->next;
}
} | 2 |
980 | struct book
{
int num;
char name[26];
}book[1000];
int judge(char*a,int b);
int main(int argc, char* argv[])
{
char c;
int n=0,i=0,j=0,rec[26]={0},k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&book[i].num,book[i].name);
}//????
for(i=0;i<26;i++)//??i??????
{
for(j=0;j<n;j++)//??j?????
{
if(judge(book[j].name,i)==1)//???j????????i
{rec[i]++;}//??i?????????rec[i]?????????
}//??????????i??????????
}//?????????26??????????????
j=0;//j??????????????????
k=rec[0];//k??????????????
for(i=0;i<25;i++)
{
if(k<rec[i])
{
j=i;
k=rec[i];
}
}
c='A'+j;
printf("%c\n%d\n",c,k);
for(i=0;i<n;i++)
{
if(judge(book[i].name,j)==1)
{printf("%d\n",book[i].num);}
}
return 0;
}
int judge(char*a,int b)
{
int i=0;
for(i=0;i<26;i++)
{
if(a[i]=='A'+b)
return 1;
}
return 0;
}
| 2 |
981 |
int main ()
{
int m;
cin >> m;
char writter[27];
int data[26][1000];
memset(data,0,sizeof(data));
int max = 0;
char max_name;
for (int i = 1; i <= m; i++){
int number;
cin >> number >> writter;
for (int j = 0; j < strlen(writter); j++){
data[writter[j]-65][0]++;
data[writter[j]-65][data[writter[j]-65][0]] = number;
if (max < data[writter[j]-65][0]){
max = data[writter[j]-65][0];
max_name = writter[j];
}
}
}
cout << max_name << endl << max << endl;
for (int i = 1; i <= max; i++)
cout << data[max_name - 65][i] << endl;
return 0;
} | 2 |
982 | int main()
{
char book[1000][20]={'\0'},name[1000][30]={'\0'};
int length,n,i,j,number[30]={0},memory,largest,temp;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %s",book[i],name[i]);
}
for(i=0;i<n;i++)
{
length=strlen(name[i]);
for(j=0;j<length;j++)
{
temp=name[i][j]-'A';
number[temp]+=1;
}
}
largest=0;
for(i=0;i<26;i++)
{
if(number[i]>largest)
{
largest=number[i];
memory=i;
}
}
printf("%c\n%d\n",'A'+memory,number[memory]);
for(i=0;i<n;i++)
{
length=strlen(name[i]);
for(j=0;j<length;j++)
{
if(name[i][j]=='A'+memory)
{
printf("%s\n",book[i]);
}
}
}
return 0;
} | 2 |
983 | void main()
{
struct book{int num;char author[26];}b[999];
int a[26]={0},n,i,j,k,max=0;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d %s",&b[i].num,b[i].author);
for(i=0;i<26;i++)
{
for(j=0;j<n;j++)
{
k=0;
while(b[j].author[k]!='\0')
{if(b[j].author[k]==i+65)a[i]++;
k++;}
}
}
for(i=0;i<26;i++)if(max<a[i])max=a[i];
i=0;
while(max!=a[i])i++;
printf("%c\n%d\n",i+65,a[i]);
for(j=0;j<n;j++)
{k=0;
while(b[j].author[k]!=i+65&&b[j].author[k]!='\0')k++;
if(b[j].author[k]==i+65)printf("%d\n",b[j].num);
}
}
| 2 |
984 | int main()
{
int m,shu[1000],num[26],length[1000];
char author[1000][26],maxauthor;
cin>>m;
memset(num,0,sizeof(num));
for(int i=0;i<m;i++)
{
cin>>shu[i]>>author[i];
length[i]=strlen(author[i]);
for(int j=0;j<length[i];j++)//??????????
num[author[i][j]-'A']+=1;
}
int maxnum=0;
for(int i=0;i<26;i++)
{
if(maxnum<num[i])
maxnum=num[i];//???????????
}
for(int i=0;i<26;i++)
{
if(num[i]==maxnum)//???????????
{
maxauthor=(char)('A'+i);
cout<<maxauthor<<endl;
cout<<maxnum<<endl;
break;
}
}
for(int i=0;i<m;i++)
{
for(int j=0;j<length[i];j++)
{
if(author[i][j]==maxauthor)//????????
cout<<shu[i]<<endl;
}
}
return 0;
}
| 2 |
985 | struct book
{
int num;
char name[27];
}b[1001];
void main()
{
int n,i,j,k,d,g[27],e=0,f=0,l;
char m,h;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&b[i].num,b[i].name);
m='A';
for(k=0;k<26;k++)
{
d=0;
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(b[i].name[j]==m)
d++;
if(b[i].name[j]=='\0')
break;
}
}
m=m+1;
g[k]=d;
if(g[k]>e)
{
e=g[k];
f=k;
}
}
h='A'+f;
printf("%c\n%d\n",h,e);
for(i=0;i<n;i++)
{
d=0;
for(j=0;j<26;j++)
{
if(b[i].name[j]==h)
d++;
if(b[i].name[j]=='\0')
break;
}
if(d!=0)
printf("%d\n",b[i].num);
}
} | 2 |
986 | void main()
{
int n,i,j,t[26]={0},k=0,max,h;
scanf("%d",&n);
struct book
{
int a;
char b[26];
}book[100]={0,""};
for(i=0;i<n;i++)
{
scanf("%d%s",&book[i].a,book[i].b);
}
for(i=0;i<n;i++)
{
k=strlen(book[i].b);
for(j=0;j<k;j++)
{
t[book[i].b[j]-65]++;
}
}
max=0;
for(i=0;i<26;i++)
{
//printf("%d ",t[i]);
if(t[i]>max)
{ max=t[i];
h=i;
}
}
printf("%c\n%d\n",h+65,max);
for(i=0;i<n;i++)
{
k=strlen(book[i].b);
for(j=0;j<k;j++)
{
if(book[i].b[j]==h+65)
printf("%d\n",book[i].a);
}
}
} | 2 |
987 | 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 |
988 | 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 |
989 |
int main()
{
char ma='A';
int cnt[ASCII]={0};
int i,j,n;
struct {
int id;
char au[MAX_N+1];
}bk[MAX_M];
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];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 |
990 | 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 |
991 | int main()
{
struct book
{
int num;
char writer[26];
}bookn[999];
struct zuozhe
{
char w;
int count;
}zuozhen[26];
int n,i;
scanf("%d",&n);
for(i=0;i<26;i++)
{
zuozhen[i].w='A'+i;
zuozhen[i].count=0;
}
int h=0;
int m,j;
for(i=0;i<n;i++)
{
scanf("%d %s",&bookn[i].num,bookn[i].writer);
m=strlen(bookn[i].writer);
for(j=0;j<m;j++)
{
h=bookn[i].writer[j]-'A';
zuozhen[h].count++;
}
}
struct zuozhe a;
a=zuozhen[0];
for(i=1;i<26;i++)
{
if(a.count<zuozhen[i].count)
a=zuozhen[i];
}
printf("%c\n",a.w);
printf("%d\n",a.count);
int t;
for(i=0;i<n;i++)
{
t=strlen(bookn[i].writer);
for(j=0;j<t;j++)
{
if(bookn[i].writer[j]==a.w)
printf("%d\n",bookn[i].num);
}
}
}
| 2 |
992 | struct book
{
int order;
int num;
char writer[26];
}b[1000];
int main()
{
int n,i,j,k,p,q[1000];
scanf("%d",&n);
for(i=0;i<=(n-1);i++)
{
scanf("%d %s",&b[i].num,b[i].writer);
b[i].order=i;
}
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 c[26];
char d[26];
for(j=0;j<=25;j++)
{
d[j]=0;
c[j]=0;
}
for(k=0;k<=25;k++)
{
for(i=0;i<=(n-1);i++)
{
p=strlen(b[i].writer);
strcpy(d,b[i].writer);
for(j=0;j<=(p-1);j++)
{
if(d[j]==a[k])
{
c[k]=c[k]+1;
}
}
for(j=0;j<=25;j++)
{
d[j]=0;
}
}
}
int max=c[0];
for(i=0;i<=25;i++)
{
if(c[i]>max)
{
max=c[i];
}
}
char x;
for(i=0;i<=25;i++)
{
if(c[i]==max)
{
x=a[i];
printf("%c\n",a[i]);
printf("%d\n",c[i]);
}
}
for(i=0;i<=999;i++)
{
q[i]=0;
}
int r=0;
char e[26];
for(i=0;i<=25;i++)
{
e[i]=0;
}
for(i=0;i<=(n-1);i++)
{
p=strlen(b[i].writer);
strcpy(e,b[i].writer);
for(j=0;j<=(p-1);j++)
{
if(e[j]==x)
{
q[r]=b[i].num;
r=r+1;
}
}
for(j=0;j<=25;j++)
{
e[j]=0;
}
}
int s=0;
for(i=0;i<=999;i++)
{
if(q[i]!=0)
{
s=s+1;
}
}
for(i=0;i<=(s-2);i++)
{
printf("%d\n",q[i]);
}
printf("%d",q[s-1]);
return 0;
}
| 2 |
993 | 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 |
994 | int main()
{
int m, a, i, j, k, n, s[26][999] = {0}, p[26] = {0};
char b[26], c;
cin >> m;
for(i = 0; i < m; i++)
{
cin >> j;
cin >> b;
n = strlen(b);
for(k = 0; k < n; k++)
{
a = b[k] - 'A';
s[a][p[a]] = j;
p[a] ++;
}
}
j = 0;
for(i = 1; i < 26; i++)
{
if(p[j] < p[i])
j = i;
}
c = 'A' + j;
cout << c << endl << p[j] << endl;
for(i = 0; ; i++)
{
if(s[j][i] != 0)
cout << s[j][i] << endl;
else break;
}
return 0;
} | 2 |
995 | int max(int array[26])
{
int i,max=0;
for(i=0;i<26;i++)
if(array[i]>max)max=array[i];
for(i=0;i<26;i++)
if(max==array[i])break;
return i;
}
void main()
{
struct book
{
int num;
char aut[26];
};
int a,i,j,m,k,t[26]={0};
struct book nbook[999];
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&nbook[i].num,nbook[i].aut);
for(i=0;i<m;i++)
for(j=0;j<26;j++)
for(k=0;k<26;k++)
if(nbook[i].aut[j]==k+65)t[k]++;
a=max(t);
printf("%c\n%d\n",a+65,t[a]);
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(nbook[i].aut[j]==a+65)printf("%d\n",nbook[i].num);
} | 2 |
996 | int main()
{
int i,j,n,x[1000],a[26],b,c,num=0;
char s[1000][26];
for(i=0;i<25;i++)
a[i]=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x[i]>>s[i];
for(j=0;s[i][j]!='\0';j++)
a[(int)s[i][j]-65]++;
}
b=a[0];
c=0;
for(i=1;i<26;i++)
if(b<a[i])
{
b=a[i];
c=i;
}
cout<<(char)(c+65)<<endl;
for(i=0;i<n;i++)
for(j=0;s[i][j]!='\0';j++)
if(s[i][j]==(char)c+65)
num++;
cout<<num<<endl;
for(i=0;i<n;i++)
for(j=0;s[i][j]!='\0';j++)
if(s[i][j]==(char)c+65)
{
cout<<x[i]<<endl;
break;
}
return 0;
} | 2 |
997 | void main()
{
struct book
{
int x;
char z[10];
struct book *next;
}*p1,*p2,*p,*head,*t;
int i,n,max=0,j,k,l,y[400],q;char u;scanf("%d",&n);
p1=p2=head=(struct book *)malloc(sizeof(struct book));
for(i=0;i<n;i++)
{
scanf("%d %s",&p1->x,p1->z);y[i]=strlen(p1->z);
p1=(struct book *)malloc(sizeof(struct book));p2->next=p1;p2=p1;
}
p=head;
for(i=0;i<n-1;i++)
{
for(j=0;j<y[i];j++)
{
q=1;t=p->next;
for(k=i+1;k<n;k++)
{
for(l=0;l<y[k];l++)
if(p->z[j]==t->z[l])q++;
t=t->next;
}
if(q>max){max=q;u=p->z[j];}
}
p=p->next;
}
printf("%c\n%d\n",u,max);
p=head;
for(i=0;i<n;i++)
{
for(j=0;j<y[i];j++)
if(u==p->z[j]){printf("%d\n",p->x);break;}
p=p->next;
}
}
| 2 |
998 | struct
{
int no;
char wr[26];
}book[999];
struct
{
char name;
int num;
int book[999];
}a[26];
int main()
{
int n,m,t,k,d;
int all=0;
for (t=0;t<26;t++)
{
a[t].name='A'+t;
a[t].num=0;
}
scanf("%d",&m);
for (t=0;t<m;t++)
{
scanf("%d %s",&book[t].no,book[t].wr);
}
for (t=0;t<m;t++)
{
k=strlen(book[t].wr);
for(n=0;n<k;n++)
{
for(d=0;d<26;d++)
{
if (a[d].name==book[t].wr[n])
{
a[d].book[a[d].num]=book[t].no;
a[d].num++;
break;
}
}
}
}
k=0;
for (t=0;t<26;t++)
{
if (k<a[t].num)
k=a[t].num;
}
for (t=0;;t++)
{
if (k==a[t].num)
{
printf("%c",a[t].name);
printf("\n%d",a[t].num);
for (d=0;d<a[t].num;d++)
printf("\n%d",a[t].book[d]);
break;
}
}
} | 2 |
999 | int main(int argc, char* argv[])
{
int m,i,j,A[26]={0},B[26];
char s;
scanf("%d",&m);
struct book{
int num;
char n[26];
}*book;
book=(struct book*)malloc(sizeof(struct book)*m);
for(i=0;i<m;i++)
{
scanf("%d %s",&book[i].num,book[i].n);
for(j=0;book[i].n[j]!='\0';j++)
{
switch(book[i].n[j])
{
case 65:A[0]++;break;
case 66:A[1]++;break;
case 67:A[2]++;break;
case 68:A[3]++;break;
case 69:A[4]++;break;
case 70:A[5]++;break;
case 71:A[6]++;break;
case 72:A[7]++;break;
case 73:A[8]++;break;
case 74:A[9]++;break;
case 75:A[10]++;break;
case 76:A[11]++;break;
case 77:A[12]++;break;
case 78:A[13]++;break;
case 79:A[14]++;break;
case 80:A[15]++;break;
case 81:A[16]++;break;
case 82:A[17]++;break;
case 83:A[18]++;break;
case 84:A[19]++;break;
case 85:A[20]++;break;
case 86:A[21]++;break;
case 87:A[22]++;break;
case 88:A[23]++;break;
case 89:A[24]++;break;
case 90:A[25]++;break;
}
}
}
int k,max;
//for(i=0;i<26;i++)
// printf("%d\n",A[i]);
for(i=0;i<26;i++)
{
B[i]=A[i];
}
for(i=25;i>0;i--)
{
if(B[i]>B[i-1])
{
B[i-1]=B[i];
max=B[i];
}
else
{
max=B[i-1];
}
}
for(i=25;i>=0;i--)
{
if(A[i]==max)
k=i;
}
//printf("%d",k);
s=k+65;
printf("%c\n%d\n",s,max);
for(i=0;i<m;i++)
{
for(j=0;book[i].n[j]!='\0';j++)
{
if(book[i].n[j]==s)
{
printf("%d\n",book[i].num);
break;
}
}
}
return 0;
}
| 2 |
Subsets and Splits