label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
2 | 700 | struct zuozhe
{
int m;
char q;
char shu[1001][5];
}zuozhe[26],t;
int main()
{
int n;
cin>>n;
int i;
char xingming[30];
char bianhao[5];
char zimu[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(i=0;i<26;i++)
zuozhe[i].m=0;
for(i=1;i<=n;i++)
{
cin>>bianhao>>xingming;
int j,k;
for(j=0;xingming[j]!='\0';j++)
{
for(k=0;k<26;k++)
{
if(xingming[j]==zimu[k])
{
zuozhe[k].m++;
zuozhe[k].q=zimu[k];
strcpy(zuozhe[k].shu[zuozhe[k].m],bianhao);
break;
}
}
}
}
int min=0;
int maxnum = 0;
for(i=0;i<26;i++)
{
if(zuozhe[i].m>maxnum)
{
maxnum = zuozhe[i].m;
min = i;
}
}
cout<<zuozhe[min].q<<endl<<zuozhe[min].m<<endl;
for(i=1;i<=zuozhe[min].m;i++)
{
cout<<zuozhe[min].shu[i]<<endl;
}
return 0;
} |
2 | 701 | struct information
{
int num;
char author[26];
}*a;
void main()
{
int n,i,j,m,s[26]={0},max=0,p;
scanf("%d",&n);
a=(struct information *)malloc(sizeof(struct information)*n);
for(i=0;i<n;i++) scanf("%d%s",&a[i].num,a[i].author);
for(i=0;i<n;i++)
{
for(j=0;a[i].author[j]!='\0';j++)
{
m=a[i].author[j]-'A';s[m]++;
}
}
for(i=0;i<26;i++)
{
if(max<s[i]) {max=s[i];p=i;}
}
printf("%c\n%d\n",'A'+p,s[p]);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(a[i].author[j]=='A'+p) {printf("%d\n",a[i].num);break;}
}
}
} |
2 | 702 | struct book
{
char number[20];
char name[26];
}books[1000];
main()
{
int n,i,j;int count[26]={0};int temp,base,k=0;char author;int pd=0,N=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %s",&books[i].number,&books[i].name);
}
for(i=0;i<n;i++)
{
for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++)
{
temp=books[i].name[j]-'A';
count[temp]++;
}
}
base=count[0];
for(i=0;i<26;i++)
{
if(count[i]>base)
{base=count[i];k=i;}
}
author='A'+k;
printf("%c\n",author);
for(i=0;i<n;i++)
{ pd=0;
for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++)
{
if(books[i].name[j]==author)
pd=1;
}
if(pd==1)
N++;
}
printf("%d\n",N);
for(i=0;i<n;i++)
{ pd=0;
for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++)
{
if(books[i].name[j]==author)
pd=1;
}
if(pd==1)
printf("%s\n",books[i].number);
}
}
|
2 | 703 | int main()
{
int n,i,j;
scanf("%d",&n);
struct book{
short int a;
char s[27];
}b[999];
short int q[26]={0};
short int w[26]={0},p,t,m;
for(i=0;i<n;i++)
{
scanf("%d %s",&b[i].a,b[i].s);
}
for(i=0;i<n;i++)
for(j=0;b[i].s[j]!='\0';j++)
{
p=(int)b[i].s[j]-65;
q[p]++;
w[p]++;
}
for(i=0;i<25;i++)
for(j=0;j<25-i;j++)
if(q[j]<q[j+1])
{
t=q[j];
q[j]=q[j+1];
q[j+1]=t;
}
for(i=0;i<25;i++)
if(w[i]==q[0])
m=i;
printf("%c\n",(char)(m+65));
printf("%d\n",w[m]);
for(i=0;i<n;i++)
for(j=0;b[i].s[j]!='\0';j++)
if(b[i].s[j]==m+65)
printf("%d\n",b[i].a);
return 0;
}
|
2 | 704 | 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 | 705 |
struct aut
{
char name;
int num;
int id[1000];
};
struct aut author[26];
int main()
{
int m,i,j,ID,max=0,maxauthor,k[26]={0};
char c[27];
scanf("%d",&m);
for(i=0;i<26;i++){
author[i].name='A'+i;
author[i].num=0;
}
for(i=0;i<m;i++){
scanf("%d %s",&ID,c);
for(j=0;c[j];j++){
author[c[j]-'A'].id[k[c[j]-'A']]=ID;
k[c[j]-'A']++;
author[c[j]-'A'].num++;
}
}
for(i=0;i<26;i++){
if(author[i].num>max){
max=author[i].num;
maxauthor=i;
}
}
printf("%c\n%d\n",author[maxauthor].name,author[maxauthor].num);
for(i=0;i<author[maxauthor].num;i++){
printf("%d\n",author[maxauthor].id[i]);
}
return 0;
} |
2 | 706 | struct book
{
int num;
char name[20];
};
void main()
{
struct book c[1000];
int i,j,n,k,max,l,d[26],a;
int b[26]={0};
scanf("%d",&n);
for(k=0;k<n;k++)
{
scanf("%d %s",&c[k].num,c[k].name);
for(i=0;i<strlen(c[k].name);i++)
{
for(j=0;j<26;j++)
{
if('A'+j==c[k].name[i])
break;
}
b[j]=b[j]+1;
}
}
for(a=0;a<26;a++)
d[a]=b[a];
max=b[0];
for(l=0;l<26;l++)
if(b[l]>max)
max=b[l];
for(a=0;a<26;a++)
{
if(d[a]==max)
break;
}
printf("%c\n",'A'+a);
printf("%d\n",max);
for(k=0;k<n;k++)
{
for(i=0;i<strlen(c[k].name);i++)
{
if('A'+a==c[k].name[i])
{
printf("%d\n",c[k].num);
break;
}
}
}
} |
2 | 707 | int alpha[26]={0};
struct library
{
int num;
char authors[27];
}books[999];
void addauthor(char string[])
{
int i=0;
do
{ alpha[string[i]-'A']++;
i++;
}
while(string[i]!='\0');
}
void hewroteit(struct library book,int maxalpha)
{
int i;
for(i=0;book.authors[i]!='\0';i++)
{
if(book.authors[i]-'A'==maxalpha)
{
printf("%d\n",book.num);
break;
}
}
}
int main()
{
int m;
scanf("%d",&m);
int i;
for(i=0;i<m;i++)
scanf("%d %s",&books[i].num,books[i].authors);
for(i=0;i<m;i++)
addauthor(books[i].authors);
int max=0,maxalpha=0;
for(i=0;i<26;i++)
{
if (alpha[i]>max)
{
max=alpha[i];
maxalpha=i;
}
}
printf("%c\n%d\n",'A'+maxalpha,max);
for(i=0;i<m;i++)
{
hewroteit(books[i],maxalpha);
}
return 0;
}
|
2 | 708 |
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 | 709 |
void main()
{
int s=0,n,i,j,b[26]={0},t,x,m,q;
char a[1000][27];
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
gets(a[i]);
}
for(i=0;i<n;i++)
{
t=strlen(a[i]);
for(j=4;j<t;j++)
{
x=a[i][j];
b[x-65]=b[x-65]+1;
}
}
for(i=0;i<26;i++)
{
if(b[i]>s)
{s=b[i];x=i;}
}
printf("%c\n",x+65);
printf("%d\n",s);
for(i=0;i<n;i++)
{
t=strlen(a[i]);
for(j=4;j<t;j++)
{
m=a[i][j];
if(m==x+65)
{
for(q=0;q<2;q++)
{printf("%c",a[i][q]);}
printf("%c\n",a[i][2]);
}
}
}
} |
2 | 710 | main()
{
int n,i,a,t,d[26]={0},f=0,c,h,e=0;
struct book
{
int N;
char name[20];
}p[1000];
scanf("%d",&n);
for(i=0;i<=n-1;i++)
scanf("%d %s",&p[i].N,p[i].name);
for(i=0;i<=n-1;i++)
{
a=strlen(p[i].name);
for(t=0;t<=a-1;t++)
{
c=p[i].name[t]-'A';
d[c]++;
}
}
for(i=0;i<=25;i++)
{
if (e<d[i])
{
e=d[i];
f=i;
}
}
h=f+'A';
printf("%c\n%d\n",h,e);
for(i=0;i<=n-1;i++)
{
a=strlen(p[i].name);
for(t=0;t<=a-1;t++)
{
if(p[i].name[t]==h)
{
printf("%d\n",p[i].N);
break;
}
}
}
} |
2 | 711 |
struct student{
char name[27];
int anum;
int num;
struct student *next;
};
int n;
int i;
char c;
struct student *creat()
{
struct student *head;
head=(struct student *)malloc(LEN);
if(n==0)
head=NULL;
else
{
scanf("%d",&head->num);
for(i=0;(c=getchar())!='\n';i++)
{
head->name[i]=c;
}
head->anum=i;
head->next=NULL;
}
return(head);
}
int main()
{
struct student *head,*p1,*p2,*p;
char l[200]={0};
int j;
int max=0;
int lmax;
scanf("%d",&n);
head=creat();
p1=p2=head;
for(i=1;i<n;i++)
{
{
p1=(struct student *)malloc(LEN);
p2->next=p1;
p2=p1;
scanf("%d",&p2->num);
for(j=0;(c=getchar())!='\n';j++)
{
p2->name[j]=c;
}
p2->anum=j;
p2->next=NULL;
}
}
p=head;
for(j=0;j<n;j++)
{
for(i=0;i<p->anum;i++)
{
l[p->name[i]]=l[p->name[i]]+1;
}
p=p->next;
}
for(i=65;i<=90;i++)
{
if(l[i]>max)
{
max=l[i];
lmax=i;
}
}
printf("%c\n%d\n",lmax,max);
p=head;
for(j=0;j<n;j++)
{
for(i=0;i<p->anum;i++)
{
if(p->name[i]==lmax)
printf("%d\n",p->num);
}
p=p->next;
}
return 0;
}
|
2 | 712 | int main()
{
int booknumber;
int order[1000];
char author[1000][27];
char single_author[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 author_booknumber[26]={0};
int i,j,k;
int tmp;
scanf("%d",&booknumber);
for(i=0;i<booknumber;i++)
{
scanf("%d%s",&order[i],author[i]);
for(j=0;j<strlen(author[i]);j++)
{
for(k=0;k<26;k++)
{
if(author[i][j]==single_author[k])
{
author_booknumber[k]++;
break;
}
}
}
}
tmp=0;
for(i=1;i<26;i++)
{
if(author_booknumber[i]>author_booknumber[tmp])
tmp=i;
}
printf("%c\n",single_author[tmp]);
printf("%d\n",author_booknumber[tmp]);
for(i=0;i<booknumber;i++)
{
for(j=0;j<strlen(author[i]);j++)
{
if(author[i][j]==single_author[tmp])
{
printf("%d\n",order[i]);
break;
}
}
}
return 0;
}
|
2 | 713 |
int main(){
struct book {
char z[27];
int no;
};
struct book a[1000];
int m, i, x, p, j ;
scanf("%d", &m);
for (i=0; i<m; i++){
scanf("%d%s", &a[i].no, a[i].z);
}
int memo[26]={0};
for (i=0; i<m; i++){
for (j=0; j<26; j++){
if (a[i].z[j]=='\0')
break;
x=(a[i].z[j])-65;
memo[x]++;
}
}
x=0;
p=0;
for (i=0; i<26; i++){
if (memo[i]>x){x=memo[i];
p=i;
}
}
printf("%c\n", p+65);
int n=0;
for (i=0; i<m; i++){
for (j=0; j<26; j++){
if (a[i].z[j]=='\0')
break;
if (a[i].z[j]==p+65)
n++;
}
}
printf("%d\n", n);
for (i=0; i<m; i++){
for (j=0; j<26; j++){
if (a[i].z[j]=='\0')
break;
if (a[i].z[j]==p+65){
printf("%d\n", a[i].no);
break;}
}
}
return 0;
}
|
2 | 714 | int main()
{
struct book
{
int No;
char name[27];
}b[1000];
int i,j,m;
scanf("%d",&m);
printf("\n");
for(i=0;i<m;i++){
scanf("%d ",&b[i].No);
scanf("%s",b[i].name);
}
int n,l,a[26]={0};
for(i=0;i<m;i++){
l=strlen(b[i].name);
for(j=0;j<l;j++){
n=b[i].name[j];a[n-65]++;
}
}
int max=0,x;
for(i=0;i<26;i++){
if(a[i]>max){max=a[i];x=i;}
}
printf("%c\n%d",x+65,max);
for(i=0;i<m;i++){
l=strlen(b[i].name);
for(j=0;j<l;j++){
if(b[i].name[j]==x+65){printf("\n%d",b[i].No);break;}
}
}
return 0;
}
|
2 | 715 | struct person{
int num;
int book[1000];
};
struct person p[26];
int n,m,i,j,k;
char str[30];
int main(){
memset(p,0,sizeof(p));
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%s",&m,str);
for(j=strlen(str)-1;j>=0;j--)
if(str[j]>='A'&&str[j]<='Z'){
k=p[str[j]-'A'].num++;
p[str[j]-'A'].book[k]=m;
}
}
m=0;
for(i=1;i<26;i++)
if(p[i].num>p[m].num)
m=i;
printf("%c\n",'A'+m);
printf("%d\n",p[m].num);
for(i=0;i<p[m].num;i++)
printf("%d\n",p[m].book[i]);
return 0;
}
|
2 | 716 | void main()
{
int *p;
p=(int *)malloc(26*sizeof(int));
struct book
{
int num;
char s[26];
}b[999];
int n,i,j,ss,max=0,r;
char x;
for(ss=0;ss<26;ss++)
*(p+ss)=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&b[i].num,b[i].s);
for(j=0;b[i].s[j]!='\0';j++)
{
*(p+((int)b[i].s[j]-65))+=1;
}
}
for(r=0;r<26;r++)
max=max>*(p+r)?max:*(p+r);
for(r=0;r<26;r++)
{
if(*(p+r)==max)
{printf("%c",(65+r));
x=r;
printf("\n");
printf("%d\n",max);}
}
for(i=0;i<n;i++)
{
for(j=0;b[i].s[j]!='\0';j++)
{
if((int)b[i].s[j]-65==x)
printf("%d\n",b[i].num);
}
}
} |
2 | 717 |
int main(int argc, char* argv[])
{
struct book{
int num;
char author[27];
}B[1000];
char A;
int m,i,j,a[26]={0},max;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d%s",&B[i].num,B[i].author);
}
for(i=0;i<m;i++){
for(j=0;;j++){
if(B[i].author[j]==0)
break;
else
a[B[i].author[j]-65]++;
}
}
max=a[0];
A=65;
for(i=0;i<26;i++){
if(a[i]>max){
max=a[i];
A=i+65;
}
}
printf("%c\n%d",A,max);
for(i=0;i<m;i++){
for(j=0;;j++){
if(B[i].author[j]==0)
break;
if(B[i].author[j]==A)
printf("\n%d",B[i].num);
}
}
return 0;
} |
2 | 718 | struct book
{
char writer[32];
int id;
struct book *next;
};
struct book *create(int m)
{
struct book *head=NULL,*p1,*p2;
int i;
p1=p2=(struct book*)malloc(Len);
scanf("%d %s",&p1->id,p1->writer);
p1->next=NULL;
head=p1;
p2=p1;
for(i=1;i<m;i++)
{
p1=(struct book*)malloc(Len);
scanf("%d %s",&p1->id,p1->writer);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
return head;
}
int main()
{
struct book *head,*p;
int m,i,*q1,*q2,j;
q1=(int*)malloc(26*sizeof(int*));
q2=q1;
for(i=0;i<26;i++)
q1[i]=0;
q1=q2;
scanf("%d",&m);
head=create(m);
p=head;
for(i=0;i<m;i++)
{
for(j=0;p->writer[j]!='\0';j++)
q1[p->writer[j]-'A']++;
p=p->next;
}
q1=q2;
int max=0;
char maxm='A';
for(i=0;i<26;i++)
if(max<q1[i]) {max=q1[i];maxm=i+'A';}
printf("%c\n%d",maxm,max);
for(i=0,p=head;i<m;i++,p=p->next)
for( j=0;p->writer[j]!='\0';j++)
if(p->writer[j]==maxm) printf("\n%d",p->id);
}
|
2 | 719 | struct books
{
int num;
char author[27];
}book[999];
void main()
{
int f(struct books *p,int n,char z);
int i,n,j,x[26],k,max;
char z;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d%s",&book[i].num,book[i].author);
for(z='A',i=0;z<='Z';z++,i++)x[i]=f(book,n,z);
for(i=1,max=x[0],k=0;i<26;i++)if(x[i]>max){max=x[i];k=i;}
printf("%c\n%d\n",k+65,max);
for(i=0;i<n;i++)for(j=0;book[i].author[j]!='\0';j++)
if(book[i].author[j]==k+65){printf("%d\n",book[i].num);break;}
}
int f(struct books *p,int n,char z)
{
int m=0,i,j;
for(i=0;i<n;i++)for(j=0;(p+i)->author[j]!='\0';j++)
if((p+i)->author[j]==z){m++;break;}
return m;
} |
2 | 720 | struct book
{int num;
char w[26];
}b[999];
void main()
{
int m,i,j,k,e;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&b[i].num,b[i].w);
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]={0};
for(j=0;j<26;j++)
{for(i=0;i<m;i++)
{e=strlen(b[i].w);
for(k=0;k<e;k++)
if(b[i].w[k]==a[j])
c[j]++;
}
}
int sum=0;
for(j=0;j<26;j++)
if(c[j]>c[sum])
sum=j;
printf("%c\n",a[sum]);
printf("%d\n",c[sum]);
for(i=0;i<m;i++)
{e=strlen(b[i].w);
for(k=0;k<e;k++)
if(b[i].w[k]==a[sum])
printf("%d\n",b[i].num);
}
}
|
2 | 721 | struct
{int no;
char wri[27];
} book[1000];
void main()
{
int n,i,j,k=0,a[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&book[i].no,book[i].wri);
for(i=0;i<n;i++)
for(j=0;book[i].wri[j]!='\0';j++)
a[book[i].wri[j]-'A']++;
for(i=0;i<26;i++)
if(a[i]>a[0]){a[0]=a[i];k=i;}
printf("%c\n%d\n",'A'+k,a[0]);
for(i=0;i<n;i++)
for(j=0;book[i].wri[j]!='\0';j++)
if(book[i].wri[j]=='A'+k){printf("%d\n",book[i].no);break;}
} |
2 | 722 | struct book
{
int num;
char writer[20];
struct book *next;
};
int main()
{
int n,i,j,m,k,c[26],max;//c[26]???????????//
char a[26];//a[26]??????//
scanf("%d",&m);
struct book *p1,*p2,*head;
for(i=0;i<m;i++)
{
p1=(struct book*)malloc(Len);
if(i==0)
{
head=p1;
}
else
{
p2->next=p1;
}
p2=p1;
scanf("%d %s",&p1->num,p1->writer);
}
p2->next=NULL;
p1=head;
for(i=0;i<26;i++)
{
a[i]=i+65;
c[i]=0;
}
for(j=0;j<m;j++)
{
for(i=0;i<26;i++)
{
n=strlen(p1->writer);
for(k=0;k<n;k++)
{
if(a[i]==p1->writer[k])
{
c[i]++;
}
}
}
p1=p1->next;
}
max=0;
for(i=0;i<26;i++)
{
if(c[i]>c[max])
{
max=i;
}
}
printf("%c\n%d\n",a[max],c[max]);
p1=head;
for(i=0;i<m;i++)
{
n=strlen(p1->writer);
for(j=0;j<n;j++)
{
if(p1->writer[j]==a[max])
{
printf("%d\n",p1->num);
}
}
p1=p1->next;
}
return 0;
}
|
2 | 723 | void main()
{
char s[400][400],t[400][400];
int n,m,i,j,k,l,p,y,z;
char c;
int a[30];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%s%s",t[i],s[i]);
j=0;
for(c=65;c<91;c++)
{
p=0;
for(k=1;k<=n;k++)
{
l=strlen(s[k]);
for(m=0;m<l;m++)
{
if(s[k][m]==c)
p++;
}
}
a[j]=p;
j++;
}
for(i=0;i<j;i++)
{
for(m=j-2;m>=i;m--)
{
if(a[m]<a[m+1])
{y=a[m];a[m]=a[m+1];a[m+1]=y;}
}
}
z=a[0];
for(c=65;c<91;c++)
{
p=0;
for(k=1;k<=n;k++)
{
l=strlen(s[k]);
for(m=0;m<l;m++)
{
if(s[k][m]==c)
p++;
}
}
if(p==z)
{
printf("%c\n",c);
printf("%d\n",z);
for(k=1;k<=n;k++)
{
p=0;
l=strlen(s[k]);
for(m=0;m<l;m++)
{
if(s[k][m]==c)
p++;
}
if(p>0)
printf("%s\n",t[k]);
}
break;
}
}
} |
2 | 724 | int main(){
struct book{
int num;
char name[26];
};
int n,i,j,a[26]={0},len[1000],k,max=0;
struct book list[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&list[i].num);
scanf("%s",list[i].name);
len[i]=strlen(list[i].name);
}
for(i=0;i<26;i++){
for(j=0;j<n;j++){
for(k=0;k<len[j];k++){
if(list[j].name[k]==i+65){
a[i]++;
break;
}
}
}
}
for(i=0;i<26;i++){
if(a[i]>max){
max=a[i];
k=i;
}
}
printf("%c\n",k+65);
printf("%d\n",max);
for(i=0;i<n;i++){
for(j=0;j<len[i];j++){
if(list[i].name[j]==k+65){
printf("%d\n",list[i].num);
}
}
}
return 0;
} |
2 | 725 | struct book
{
int num;
char w[100];
}book[100];
void main()
{
int i,j,k,l,m,n,p,b[26]={0};
scanf ("%d\n",&n);
for (i=0;i<n;i++)
{
scanf ("%d %s",&book[i].num,book[i].w);
}
for (i=0;i<n;i++)
{
for (j=0;book[i].w[j]!='\0';j++)
{
if (book[i].w[j]=='A') b[0]++;
else if (book[i].w[j]=='B') b[1]++;
else if (book[i].w[j]=='C') b[2]++;
else if (book[i].w[j]=='D') b[3]++;
else if (book[i].w[j]=='E') b[4]++;
else if (book[i].w[j]=='F') b[5]++;
else if (book[i].w[j]=='G') b[6]++;
else if (book[i].w[j]=='H') b[7]++;
else if (book[i].w[j]=='I') b[8]++;
else if (book[i].w[j]=='J') b[9]++;
else if (book[i].w[j]=='K') b[10]++;
else if (book[i].w[j]=='L') b[11]++;
else if (book[i].w[j]=='M') b[12]++;
else if (book[i].w[j]=='N') b[13]++;
else if (book[i].w[j]=='O') b[14]++;
else if (book[i].w[j]=='P') b[15]++;
else if (book[i].w[j]=='Q') b[16]++;
else if (book[i].w[j]=='R') b[17]++;
else if (book[i].w[j]=='S') b[18]++;
else if (book[i].w[j]=='T') b[19]++;
else if (book[i].w[j]=='U') b[20]++;
else if (book[i].w[j]=='V') b[21]++;
else if (book[i].w[j]=='W') b[22]++;
else if (book[i].w[j]=='X') b[23]++;
else if (book[i].w[j]=='Y') b[24]++;
else if (book[i].w[j]=='Z') b[25]++;
}
}
for (i=0;i<=25;i++)
{
for (j=0;j<26;j++)
{
if (b[i]<b[j])
break;
}
if (j==26)
{
printf ("%c\n%d\n",65+i,b[i]);
break;
}
}
for (j=0;j<n;j++)
{
for (l=0;book[j].w[l]!='\0';l++)
{
if (book[j].w[l]==65+i)
{
printf ("%d\n",book[j].num);
break;
}
}
}
} |
2 | 726 | int main()
{
int n,i,j,k;
scanf("%d\n",&n);
struct book
{
int num;
char name[26];
}book[999];
for(i=0;i<n;i++)
{ scanf("%d %s\n",&book[i].num,book[i].name);
}
struct author
{
char l;
int count;
}au[26];
for(i=0;i<26;i++)
{ au[i].l=65+i;
au[i].count=0;
}
for(i=0;i<26;i++)
{ for(j=0;j<n;j++)
{ for(k=0;k<26;k++)
{if(au[i].l==book[j].name[k])
{au[i].count++;
break;
}
}
}
}
int max=0;
for(i=1;i<26;i++)
{ if(au[max].count<au[i].count)
max=i;
}
printf("%c\n%d\n",au[max].l,au[max].count);
for(j=0;j<n;j++)
{ for(k=0;k<26;k++)
{
if(au[max].l==book[j].name[k])
{ printf("%d\n",book[j].num);
break;
}
}
}
return 0;
}
|
2 | 727 |
struct book
{
int num;
char *name;
struct book *next;
}
main()
{
int n,i;
scanf("%d",&n);
struct book *p1,*p2,*head;
p1=len;
head=p1;
for(i=0;i<n;i++)
{
p1->name=(char *)malloc(26*1);
scanf("%d %s",&p1->num,p1->name);
p2=len;
p1->next=p2;
p1=p2;
}
p1=p2=head;
int *a;
a=(int *)malloc(26*4);
for(i=0;i<26;i++)
*(a+i)=0;
int j;
int l;
for(i=0;i<n;i++)
{
j=0;
while(*(p1->name+j)!='\0')
{
l=*(p1->name+j)-'A';
*(a+l)+=1;
j+=1;
}
p1=p1->next;
}
int max=0,maxl;
for(i=0;i<26;i++)
if(*(a+i)>max)
{
max=*(a+i);
maxl='A'+i;
}
printf("%c\n%d\n",maxl,max);
p1=p2=head;
for(i=0;i<n;i++)
{
j=0;
while(*(p1->name+j)!='\0')
{
if(*(p1->name+j)==maxl)
{
printf("%d\n",p1->num);
break;
}
j+=1;
}
p1=p1->next;
}
} |
2 | 728 | struct book
{
int num;
char author[27];
}book[1000];
void main()
{
int m,i,j,k;
char s[26];
int w[26]={0};
int len[1000];
int max,most;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&book[i].num,book[i].author);
}
for(i=0;i<26;i++)
{
s[i]='A'+i;
}
for(i=0;i<m;i++)
{
len[i]=strlen(book[i].author);
for(j=0;j<len[i];j++)
{
for(k=0;k<26;k++)
{
if(book[i].author[j]==s[k])
w[k]++;
}
}
}
max=w[0];
most=0;
for(i=0;i<26;i++)
{
if(w[i]>max)
{
max=w[i];
most=i;
}
}
printf("%c\n%d\n",s[most],max);
for(i=0;i<m;i++)
{
len[i]=strlen(book[i].author);
for(j=0;j<len[i];j++)
{
if(book[i].author[j]==s[most])
printf("%d\n",book[i].num);
}
}
} |
2 | 729 | 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 | 730 | void main()
{
int n,m,i,j,k,t,max=0;
int a[1000],b[26]={0};
char s[1000][30];
char c;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i],s[i]);
for(i=0;i<n;i++)
{
m=strlen(s[i]);
for(j=0;j<m;j++)
{
t=s[i][j]-65;
b[t]++;
}
}
for(i=0;i<26;i++)
if(b[i]>=max) max=b[i];
for(i=0;i<26;i++)
{
if(b[i]==max)
{
k=i;
c=i+65;
printf("%c\n",c);
printf("%d\n",max);
}
}
for(i=0;i<n;i++)
{
m=strlen(s[i]);
for(j=0;j<m;j++)
if(s[i][j]==65+k) printf("%d\n",a[i]);
}
} |
2 | 731 | struct book
{
int num;
char name[27];
};
int main()
{
int n,i,j,l,sum[26],t=0,T=0;struct book a[1000];memset(sum,0,sizeof(sum));char A;
cin >> n;
for(i=0;i<n;i++)
{
cin >> a[i].num >> a[i].name;
l=strlen(a[i].name);
for(j=0;j<l;j++)
{
sum[a[i].name[j]-'A']++;
}
}
for(i=0;i<26;i++)
{
if(sum[i]>t)
{
t=sum[i];T=i;
}
}
A='A'+T;
cout << A << endl;
cout << t << endl;
for(i=0;i<n;i++)
{
for(j=0;j<27;j++)
{
if(a[i].name[j]==A)
cout << a[i].num << endl;
}
}
return 0;
} |
2 | 732 | struct book
{
int id;
char str[27];
}bo[1000];
struct people
{
int name;
int number;
int book_number[1000];
}people[26];
int main ( )
{
int n, i, j, k, m, max = 0;
char a[27] = {'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','\0'};
cin >> n;
for(i = 0;i < n;i++)
{
cin >> bo[i].id >> bo[i].str;
}
for(i = 0;i < 26;i++)//???
{
people[i].number = 0;
}
for(i = 0;i < n;i++)
{
m = strlen(bo[i].str);
for(j = 0;j < m;j++)
{
for(k = 0;k < 26;k++)//???????????
{
if(bo[i].str[j] == a[k])
{
people[k].book_number[people[k].number] = bo[i].id;
people[k].number++;
}
}
}
}
j = 0;
for(i = 0;i < 26;i++)//?????????
{
if(people[i].number > max)
{
j = i;
max = people[i].number;
}
}
cout << a[j] << endl;
cout << people[j].number << endl;
for(i = 0;i < people[j].number;i++)
{
cout << people[j].book_number[i] << endl;
}
return 0;
} |
2 | 733 |
main(){
int i, sum[26]={0}, m, j, max=0, p;
struct book{
int num;
char au[27];
int l;
};
struct book bk[1000];
scanf("%d", &m);
for(i=0; i<m; i++){
scanf("%d %s", &bk[i].num, bk[i].au);
bk[i].l=strlen(bk[i].au);
for(j=0; j<bk[i].l; j++){
switch(bk[i].au[j]){
case 'A': sum[0]+=1; break;
case 'B': sum[1]+=1; break;
case 'C': sum[2]+=1; break;
case 'D': sum[3]+=1; break;
case 'E': sum[4]+=1; break;
case 'F': sum[5]+=1; break;
case 'G': sum[6]+=1; break;
case 'H': sum[7]+=1; break;
case 'I': sum[8]+=1; break;
case 'J': sum[9]+=1; break;
case 'K': sum[10]+=1; break;
case 'L': sum[11]+=1; break;
case 'M': sum[12]+=1; break;
case 'N': sum[13]+=1; break;
case 'O': sum[14]+=1; break;
case 'P': sum[15]+=1; break;
case 'Q': sum[16]+=1; break;
case 'R': sum[17]+=1; break;
case 'S': sum[18]+=1; break;
case 'T': sum[19]+=1; break;
case 'U': sum[20]+=1; break;
case 'V': sum[21]+=1; break;
case 'W': sum[22]+=1; break;
case 'X': sum[23]+=1; break;
case 'Y': sum[24]+=1; break;
case 'Z': sum[25]+=1; break;
}
}
}
for(i=0; i<26; i++){
if(sum[i]>max){
max=sum[i];
p=i;
}
else;
}
printf("%c\n%d", p+65, max);
for(i=0; i<m; i++){
for(j=0; j<bk[i].l; j++){
if(bk[i].au[j]==p+65){
printf("\n%d", bk[i].num);
break;
}
else;
}
}
} |
2 | 734 | 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 | 735 |
void function(int,int);
int main()
{
char s[200][100];
int n[100],h[100],maxh[100];
int a;
int i,j,k,p;
int num,maxnum=0;
char c;
scanf("%d",&a);
for(i=0;i<a;i++)
{
scanf("%d%s",&n[i],s[i]);
}
for(j='A';j<='Z';j++)
{
num=0;
for(i=0;i<a;i++)
{
for(k=0;k<strlen(s[i]);k++)
{
if(s[i][k]==j)
{
num++;
h[num]=n[i] ;
}
}
}
if(num>maxnum)
{
c=j;
maxnum=num;
for(p=1;p<=maxnum;p++)
{
maxh[p]=h[p];
}
}
}
printf("%c\n%d\n",c,maxnum);
for(p=1;p<=maxnum;p++)
{
printf("%d\n",maxh[p]);
}
return 0;
} |
2 | 736 |
struct Article {
int number;
char author[26];
};
int main()
{
struct Article book[1000];
int m, i;
int j, k;
int c;
int max = 0;
int writer[26] = {0};
scanf("%d",&m);
for (i = 0; i < m; i++) {
scanf("%d %s",&book[i].number,book[i].author);
}
for (i = 0; i < m; i++) {
for (j = 0; j < 26; j++) {
if (book[i].author[j] >= 'A' && book[i].author[j] <= 'Z') {
c = book[i].author[j] - 'A';
writer[c]++;
}
}
}
for (i = 0; i < 26; i++) {
if (max < writer[i]) {
max = writer[i];
}
}
for (i = 0; i < 26; i++) {
if (max == writer[i]) {
printf("%c\n",i + 'A');
printf("%d\n",max);
for (j = 0; j < m; j++) {
for (k = 0; k < 26; k++) {
if (book[j].author[k] == i + 'A') {
printf("%d\n",book[j].number);
}
}
}
break;
}
}
return 0;
} |
2 | 737 | void main()
{
struct ts
{
int sl;
char zz[30];
int zzsl;
struct ts *next;
};
struct ts *p1,*p2,*head;
int i,j,k,m,n,max,zzzdnum,num[100]={0};
char zzzd;
scanf("%d",&n);
p1=p2=head=(struct ts *)malloc(sizeof(struct ts));
scanf("%d %s",&p1->sl,p1->zz);
// p1->zzsl=strlen(p1->zz);//?????
for(i=1;i<n;i++)
{
p1=(struct ts *)malloc(sizeof(struct ts));
scanf("%d %s",&p1->sl,p1->zz);
p1->zzsl=strlen(p1->zz);
p2->next=p1;
p2=p1;
}
p1->next=0;
for(i='A';i<='Z';i++)
{
p1=head;
for(k=0;k<n;k++)
{
for(j=0;p1->zz[j]!='\0';j++)
{
if(p1->zz[j]==i)num[i]++;
}
p1=p1->next;
}
}
max=0;
for(i='A';i<='Z';i++)
{
max=max>num[i]?max:num[i];
}
for(i='A';i<='Z';i++)
{
if(num[i]==max)zzzd=i;//????????
}
printf("%c\n%d\n",zzzd,max);
p1=head;
zzzdnum=0;
for(i=0;i<n;i++)
{
for(j=0;p1->zz[j]!='\0';j++)
{
if(p1->zz[j]==zzzd)
{
printf("%d\n",p1->sl);
}
}
p1=p1->next;
}
}
|
2 | 738 |
char name;
int num,k=0,t=0;
int nametimes[100]={0};
struct book
{
unsigned int No;
char Name[26];
}*p;
void operate()
{
int i;
for(i=65;i<91;i++)
if(nametimes[i]>t)
{
t=nametimes[i];
name=i;
}
}
void print()
{
struct book *pi;
int i;
printf("%c\n%d\n",name,t);
for(pi=p;pi<p+num;pi++)
for(i=0;pi->Name[i]!='\0';i++)
if(pi->Name[i]==name)
{
if(k==0)
{
printf("%d",pi->No);
k++;
}
else
printf("\n%d",pi->No);
break;
}
}
main()
{
scanf("%d",&num);
struct book *pi;
int i;
p=(struct book*)malloc(num*sizeof(struct book));
for(pi=p;pi<p+num;pi++)
{
scanf("%d %s",&pi->No,pi->Name);
for(i=0;pi->Name[i]!='\0';i++)
nametimes[(int)pi->Name[i]]++;
}
operate();
print();
}
|
2 | 739 | void main()
{
struct book
{
int num;
char a[100];
};
struct book b[1000];
int n,i,j,s,t=0,m,h;
int c[1000];
char d[27];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&b[i].num,b[i].a);
d[0]=b[0].a[0];
t=1;
c[0]=0;
for(i=0;i<n;i++)
{
for(j=0;b[i].a[j]!=0;j++)
{
int x=0;
for(s=0;s<t;s++)
{
if(b[i].a[j]==d[s])
{
c[s]=c[s]+1;
x=0;
break;
}
else
x=1;
}
if(x==1)
{
t++;
d[t-1]=b[i].a[j];
c[t-1]=1;
}
}
}
m=c[0];
h=0;
for(i=0;i<t;i++)
{
if(c[i]>m)
{
m=c[i];
h=i;
}
}
printf("%c\n%d\n",d[h],m);
for(i=0;i<n;i++)
{
for(j=0;b[i].a[j]!=0;j++)
{
if(b[i].a[j]==d[h])
{
printf("%d\n",b[i].num);break;
}
}
}
} |
2 | 740 | struct book
{
int num;
char author[26];
struct book *next;
};
struct book *creat()
{
int n;
scanf("%d",&n);
int i=1;
struct book *head,*p1,*p2;
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->num,p1->author);
p1->next=NULL;
if(i>=n) {free(p1);head=NULL;return head;}
else
{head=p1;
p2=p1;
while(i<n)
{p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->num,p1->author);
p1->next=NULL;
i++;
{p2->next=p1;p2=p1;}
}
p2->next=p1;
p1->next=NULL;
return head;
}
}
int max(char letter,struct book *head)
{
int i,j,k;
i=0;
struct book *q;
q=head;
while(q!=NULL)
{
k=strlen(q->author);
for(j=0;j<k;j++)
{if((q->author)[j]==letter) i++;}
q=q->next;
}
return i;
}
void outbook(char letter,struct book *head)
{
int j,k;
struct book *q;
q=head;
while(q!=NULL)
{
k=strlen(q->author);
for(j=0;j<k;j++)
{if((q->author)[j]==letter) printf("%d\n",q->num);}
q=q->next;
}
}
void main()
{
int i,m,s;
struct book *p0,*p1;
p0=p1=creat();
int sum[26];
for(i=0;i<26;i++)
{
sum[i]=max(i+65,p0);
}
s=0;
m=sum[0];
for(i=0;i<26;i++)
{
if(sum[i]>m) {m=sum[i];s=i;}
}
printf("%c\n",s+65);
printf("%d\n",m);
outbook(s+65,p1);
} |
2 | 741 | void main()
{
int n,i,best=0,max=0,a[26]={0},num[100],l,j,k;
char letter[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'},
writer[100][26];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&num[i],&writer[i]);
}
for(i=0;i<n;i++)
{
l=strlen(writer[i]);
for(j=0;j<l;j++)
{
for(k=0;k<26;k++)
{
if(writer[i][j]==letter[k]) {a[k]++;break;}
}
}
}
for(i=0;i<26;i++)
{
if(max<a[i])
{
best=i;max=a[i];
}
}
printf("%c\n",letter[best]);
printf("%d\n",max);
for(i=0;i<n;i++)
{
l=strlen(writer[i]);
for(j=0;j<l;j++)
{
if(writer[i][j]==letter[best])
{
printf("%d\n",num[i]);;break;
}
}
}
} |
2 | 742 |
int main()
{
int bookno[100];
char author[100][26];
int numOfauthor[26] = {0};
int nbook, max = 0, maxno;
char maxauthor;
cin >> nbook;
int i, j;
for ( i = 0; i < nbook; i ++)
{
cin >> bookno[i];
cin.get();
cin.getline(*(author + i), 26);
}
for ( i = 0; i < nbook; i ++)
for ( j = 0; author[i][j] !='\0'; j ++)
{
numOfauthor[author[i][j] - 'A'] ++;
}
for ( i = 0; i < 26; i ++)
{
if ( numOfauthor[i] > max)
{
max = numOfauthor[i];
maxno = i;
}
}
maxauthor = maxno + 'A';
cout << maxauthor << endl;
cout << numOfauthor[maxno] << endl;
for ( i = 0; i < nbook; i ++)
for ( j = 0; author[i][j] != '\0'; j ++)
{
if ( author[i][j] == maxauthor )
cout << bookno[i] << endl;
}
return 0;
}
|
2 | 743 | int main()
{
int m;
cin>>m;
int book[1000];
char person[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char people[100][100];
int i,j;
int l;
int t[100]={0};
for(i=1;i<=m;i++)
{
cin>>book[i];
cin>>people[i];
l=strlen(people[i]);
for(j=0;j<l;j++)
{
t[people[i][j]-'A']++;
}
}
int max=0,tt;
for(i=0;i<=26;i++)
{
if(t[i]>max)
{
max=t[i];
tt=i;
}
}
cout<<person[tt]<<endl;
cout<<max<<endl;
int k;
int already[26]={1};
for(i=1;i<=m;i++)
{
l=strlen(people[i]);
for(j=0;j<l;j++)
{
if(people[i][j]==person[tt])
{
cout<<book[i]<<endl;
for(k=0;k<l;k++)
{
if((people[i][k]!=person[tt])&&(already[people[i][k]-'A']!=0))
{
//cout<<people[i][k]<<endl;
already[people[i][k]-'A']=0;
}
}
break;
}
}
}
return 0;
} |
2 | 744 |
struct book
{
int num;
char writer[26];
};
int m;
int main()
{
int i;
scanf("%d",&m);
book *p;
p=(struct book*)malloc(sizeof(struct book)*m);
for(i=0;i<m;i++)
{
scanf("%d %s",&p[i].num,p[i].writer);
}
int j=0,u=0;
int *a;
a=(int *)malloc(sizeof(int)*150);
for(i='A';i<='z';i++)
a[i]=0;
for(i='A';i<='Z';i++)
{
for(j=0;j<m;j++)
{
for(u=0;u<strlen(p[j].writer);u++)
{
if(i==p[j].writer[u])
{
a[i]++;
break;
}
}
}
}
int max=0;
for(i='A';i<='Z';i++)
{
if(max<a[i])
max=a[i];
}
for(i='A';i<='Z';i++)
{
if(max==a[i])
break;
}
printf("%c\n%d\n",i,a[i]);
for(j=0;j<m;j++)
{
for(u=0;u<strlen(p[j].writer);u++)
{
if(i==p[j].writer[u])
{
printf("%d\n",p[j].num);
break;
}
}
}
return 0;
}
|
2 | 745 | void main()
{
int a[1000],i,j,m,b[26],t=0,k;
char c[1000][20];
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&a[i],c[i]);
for(i=0;i<m;i++)
for(j=0;j<strlen(c[i]);j++)
if('A'<c[i][j]<'Z') b[c[i][j]-65]++;
for(i=0;i<26;i++)
if(b[i]>t){t=b[i];k=i;}
printf("%c\n",k+65);
printf("%d\n",t);
for(i=0;i<m;i++)
for(j=0;j<strlen(c[i]);j++)
{
if(c[i][j]==k+65) printf("%d\n",a[i]);
}
} |
2 | 746 | 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 | 747 | void main()
{
struct book
{
int num;
char author[27];
struct book *next;
}*head = 0,*p1,*p2;
int total,i,j,sumbook[26]={0},len,max;
scanf("%d",&total);
for(i=0;i<total;i++)
{
p1=(struct book *)malloc(sizeof(struct book));
if(p1==0)
{
printf("Memory request failed!\n");
exit(-1);
}
scanf("%d %s",&p1->num,p1->author);
len = strlen(p1->author);
for(j = 0;j<len;j++)
sumbook[p1->author[j]-'A']++;
if(head)
p2->next=p1;
else
head=p1;
p2=p1;
}
p1->next=0;
len = 0;
for(i = 0;i<26;i++)
{
if(sumbook[i]>len)
{
len = sumbook[i];
max = i;
}
}
printf("%c\n%d\n",max+'A',sumbook[max]);
max += 'A';
for(p1=head;p1;p1=p1->next)
{
len = strlen(p1->author);
for(i = 0;i<len;i++)
{
if(p1->author[i]==max)
{
printf("%d\n",p1->num);
break;
}
}
}
} |
2 | 748 | struct a
{
int number;
char author[26];
}b[100];
int main()
{
int L[26]={0};
int n=0;
int max=0;
int p=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>b[i].number;
cin>>b[i].author;
for(int j=0;b[i].author[j]!='\0';j++)
L[b[i].author[j]-'A']++;
}
for(int i=0;i<26;i++)
if(max<L[i])
{
p=i;
max=L[i];
}
cout<<(char)(p+'A')<<endl;
cout<<max<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;b[i].author[j]!='\0';j++)
{
if(b[i].author[j]-p=='A')
{
cout<<b[i].number<<endl;
break;
}
}
}
return 0;
} |
2 | 749 | 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 | 750 | struct shu
{int num;
char author[26];
};
void main()
{
struct shu shu[999];
int n,i,j,k,m;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&shu[i].num,shu[i].author);
int a[26]={0};
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(shu[i].author[j]=='A') a[0]=a[0]+1;
else if(shu[i].author[j]=='B') a[1]=a[1]+1;
else if(shu[i].author[j]=='C') a[2]=a[2]+1;
else if(shu[i].author[j]=='D') a[3]=a[3]+1;
else if(shu[i].author[j]=='E') a[4]=a[4]+1;
else if(shu[i].author[j]=='F') a[5]=a[5]+1;
else if(shu[i].author[j]=='G') a[6]=a[6]+1;
else if(shu[i].author[j]=='H') a[7]=a[7]+1;
else if(shu[i].author[j]=='I') a[8]=a[8]+1;
else if(shu[i].author[j]=='J') a[9]=a[9]+1;
else if(shu[i].author[j]=='K') a[10]=a[10]+1;
else if(shu[i].author[j]=='L') a[11]=a[11]+1;
else if(shu[i].author[j]=='M') a[12]=a[12]+1;
else if(shu[i].author[j]=='N') a[13]=a[13]+1;
else if(shu[i].author[j]=='O') a[14]=a[14]+1;
else if(shu[i].author[j]=='P') a[15]=a[15]+1;
else if(shu[i].author[j]=='Q') a[16]=a[16]+1;
else if(shu[i].author[j]=='R') a[17]=a[17]+1;
else if(shu[i].author[j]=='S') a[18]=a[18]+1;
else if(shu[i].author[j]=='T') a[19]=a[19]+1;
else if(shu[i].author[j]=='U') a[20]=a[20]+1;
else if(shu[i].author[j]=='V') a[21]=a[21]+1;
else if(shu[i].author[j]=='W') a[22]=a[22]+1;
else if(shu[i].author[j]=='X') a[23]=a[23]+1;
else if(shu[i].author[j]=='Y') a[24]=a[24]+1;
else if(shu[i].author[j]=='Z') a[25]=a[25]+1;
}
}
k=a[0],m=0;
for(i=0;i<26;i++)
{
if(k<a[i])
{
k=a[i];
m=i;
}
}
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'};
printf("%c\n",b[m]);
printf("%d\n",k);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(shu[i].author[j]==b[m])
{
printf("%d\n",shu[i].num);
break;
}
}
}
} |
2 | 751 | int a[30]={0},b[30][1000];
struct stu
{
int num;
char name[30];
struct stu *next;
};
struct stu *creat(int n)
{
struct stu *p1,*p2,*head;
int i=0;
p1=p2=(struct stu *)malloc(sizeof(struct stu));
scanf("%d %s",&p1->num,p1->name);
head=0;
for(i=0;i<n;i++)
{
if(i==0)
head=p1;
else
p2->next=p1;
p2=p1;
if(i<n-1)
{
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%d %s",&p1->num,p1->name);
}
}
p2->next=0;
return head;
}
int check(struct stu *head,int n)
{
int i,j,s,d=0,f=0;
char *t;
struct stu *p;
p=head;
for(i=0;i<n;i++,p=p->next)
{
s=strlen(p->name);
t=p->name;
for(j=0;j<s;j++)
{
d=t[j]-64;
a[d]++;
b[d][a[d]-1]=p->num;
}
}
for(i=1;i<=26;i++)
{
for(j=1,f=0;j<=26;j++)
{
if(a[i]<a[j])
{
f=1;
break;
}
}
if(f==0)
break;
}
return i;
}
void main ()
{
struct stu *head;
int i,j,n;
scanf("%d",&n);
head=creat(n);
i=check(head,n);
printf("%c\n%d\n",i+64,a[i]);
for(j=0;j<a[i];j++)
printf("%d\n",b[i][j]);
} |
2 | 752 | int main()
{
int m,i,j,a[1000],c[91]={0},k,n,p=0;
char b[1000][26],q;
scanf("%d", &m);
for(i=1;i<=m;i++)
{
scanf("%d%s", &a[i], b[i]);
n=strlen(b[i]);
for(j=0;j<=n-1;j++)
{
k=b[i][j];
c[k]++;
}
}
for(i=65;i<91;i++) if(c[i]>p) {p=c[i]; q=i;}
printf("%c\n%d\n", q, p);
for(i=1;i<=m;i++)
{
n=strlen(b[i]);
for(j=0;j<=n-1;j++) if(b[i][j]==q) printf("%d\n", a[i]);
}
return 0;
}
|
2 | 753 | struct BOOK{
int id;
int author[26];
};
int main(){
struct BOOK book[1000];
int countauthor[26];
int n,i,j,minusA,no,count,max=0,maxau;
char input[30];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<26;j++){
book[i].author[j]=0;
}
}// refresh data: each book-->all authors initiate with 0
for(i=0;i<n;i++){
scanf("%d",&book[i].id);
scanf("%s",&input);
no=strlen(input);
for(j=0;j<no;j++){
minusA=(input[j]-'A');
book[i].author[minusA]++;
}
}
for(i=0;i<26;i++){
count=0;
for(j=0;j<n;j++){
if(book[j].author[i]==1)
count++;
}
countauthor[i]=count;
}
for(i=0;i<26;i++){
if(max<countauthor[i])
max=countauthor[i];
}// to find max
for(i=0;i<26;i++){
if(countauthor[i]==max)
maxau=i;
}//to find which author has maximum number of book
printf("%c\n%d\n",(maxau+'A'),max);
for(i=0;i<n;i++){
if(book[i].author[maxau]==1){
printf("%d\n",book[i].id);
}
}
return 0;
} |
2 | 754 |
int main()
{
int a;
scanf("%d",&a);
char zuozhe[100][100];
int shuhao[100];
int zuo[200];
int shu[200][200];
int n=0,p,i,j;
int m[200];
for(i=0;i<200;i++)
{ zuo[i]=0;
m[i]=0;
}
for(i=0;i<a;i++)
{
scanf("%d %s",&shuhao[i],zuozhe[i]);
}
for(i=0;i<a;i++)
{
for(j=0;(zuozhe[i][j])!='\0';j++)
{
zuo[(zuozhe[i][j])]=zuo[(zuozhe[i][j])]+1;
shu[(zuozhe[i][j])][(m[(zuozhe[i][j])])]=shuhao[i];
m[(zuozhe[i][j])]=m[(zuozhe[i][j])]+1;
}
}
for(i=65;i<=90;i++)
{
if(zuo[i]>n)
{
n=zuo[i];
p=i;
}
}
printf("%c\n",p);
printf("%d\n",zuo[p]);
for(i=0;i<m[p];i++)
{
printf("%d\n",shu[p][i]);
}
return 0;
}
|
2 | 755 | int main(int argc, char* argv[])
{
struct {
int a;
char b[26];
}num[999];
int i,m,j,k;
int s[26];
scanf ("%d",&m);
for (i=0;i<m;i++)
{
scanf ("%d%s",&num[i].a,num[i].b);
}
for (k=0;k<26;k++)
{
s[k]=0;
}
for (i=0;i<m;i++)
{
for (j=0;num[i].b[j]!='\0';j++)
{
k=num[i].b[j]-'A';
s[k]++;
}
}
int first=s[0];
int t;
for (k=0;k<26;k++)
{
if (s[k]>first)
{
first=s[k];
t=k;
}
}
printf ("%c\n",t+'A');
printf ("%d\n",first);
for (i=0;i<m;i++)
{
for (j=0;num[i].b[j]!='\0';j++)
{
if (num[i].b[j]==(t+'A'))
{
printf ("%d\n",num[i].a);
}
}
}
return 0;
}
|
2 | 756 | int main(){
int max,max1,t,k,x[28]={0},n,a,b,c,d,i,j;
char cc,y[100][32],q;
scanf("%d",&n);
scanf("%c",&cc);
for(i=1;i<=n;i++){
gets(y[i]);
for(j=2;y[i][j];j++){
if(y[i][j]>='A'&&y[i][j]<='Z'){
x[y[i][j]+1-'A']++;}
}}
max=x[1];
max1=1;
for(i=2;i<=26;i++){
if(x[i]>max){
max=x[i];
max1=i;}}
q='A'-1+max1;
printf("%c\n",q);
printf("%d\n",max);
for(i=1;i<=n;i++){
for(j=2;y[i][j];j++){
if(y[i][j]==q){
for(t=0;y[i][t];t++){
if(y[i][t]==' ')break;
else printf("%c",y[i][t]);
}
printf("\n");
break;
}
}
}
}
|
2 | 757 | void main()
{
int n,a[1000]={0},c[27]={0},i,j,k,m,p,d[1000]={0};
char b[1000][30]={{0}};
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<26;j++)
{
for(k=1;k<=26;k++)
{
if(b[i][j]==64+k)c[k]=c[k]+1;
}
}
}
m=c[1];
p=1;
for(i=1;i<27;i++)
{
if(c[i]>m)
{
m=c[i];
p=i;
}
}
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(b[i][j]==64+p)d[i]=1;
}
}
printf("%c\n",64+p);
printf("%d\n",m);
for(i=0;i<1000;i++)
{
if(d[i]==1)printf("%d\n",a[i]);
}
}
|
2 | 758 | int main()
{
int m,i,j,max=0;
int Q[26]={0};
struct
{
int num;
char name[27];
}book[1000];
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&book[i].num,book[i].name);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(book[i].name);j++)
{
switch(book[i].name[j])
{
case 'A':
Q[0]++;
break;
case 'B':
Q[1]++;
break;
case 'C':
Q[2]++;
break;
case 'D':
Q[3]++;
break;
case 'E':
Q[4]++;
break;
case 'F':
Q[5]++;
break;
case 'G':
Q[6]++;
break;
case 'H':
Q[7]++;
break;
case 'I':
Q[8]++;
break;
case 'J':
Q[9]++;
break;
case 'K':
Q[10]++;
break;
case 'L':
Q[11]++;
break;
case 'M':
Q[12]++;
break;
case 'N':
Q[13]++;
break;
case 'O':
Q[14]++;
break;
case 'P':
Q[15]++;
break;
case 'Q':
Q[16]++;
break;
case 'R':
Q[17]++;
break;
case 'S':
Q[18]++;
break;
case 'T':
Q[19]++;
break;
case 'U':
Q[20]++;
break;
case 'V':
Q[21]++;
break;
case 'W':
Q[22]++;
break;
case 'X':
Q[23]++;
break;
case 'Y':
Q[24]++;
break;
case 'Z':
Q[25]++;
break;
}
}
}
for(i=1;i<26;i++)
{
if(Q[i]>Q[max])
max=i;
}
printf("%c\n%d\n",max+65,Q[max]);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(book[i].name);j++)
{
if(book[i].name[j]==max+65)
{
printf("%d\n",book[i].num);
break;
}
}
}
return 0;
} |
2 | 759 | struct book{
char a[1000];
char b[26];
}book[1000];
int main()
{
int m,i,j,s,k,p,l;
int t[26]={0};
char x;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%s %s",&book[i].a,book[i].b);
for(i=0;i<m;i++)
{
s=strlen(book[i].b);
for(j=0;j<s;j++)
{
x=book[i].b[j];
k=x;
t[k-65]=t[k-65]+1;
}
}
p=t[0];
l=0;
for (i=1;i<26;i++)
{
if(t[i]>p)
{
p=t[i];
l=i;
}
}
x=l+65;
printf("%c\n",x);
printf("%d\n",p);
for(i=0;i<m;i++)
{
s=strlen(book[i].b);
for(j=0;j<s;j++)
{
if(book[i].b[j]==x)
{
printf("%s\n",book[i].a);
}
}
}
return 0;
}
|
2 | 760 | struct j
{
int bianhao;
char zuozhe[100];
};
main()
{
int m,i,l,k,z,max=0;
int shumu[26];
scanf("%d",&m);
struct j * a;
a=(struct j *)malloc(m*sizeof(j));
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i].bianhao,a[i].zuozhe);
}
for(z=0;z<26;z++)
{
shumu[z]=0;
for(i=0;i<m;i++)
{
char * p;
p=a[i].zuozhe;
l=strlen(a[i].zuozhe);
for(k=0;k<l;k++)
{
if(p[k]=='A'+z)
shumu[z]++;
}
}
}
for(z=0;z<26;z++)
{
if(shumu[z]>max)
max=shumu[z];
}
for(z=0;z<26;z++)
{
if(shumu[z]==max)
{
printf("%c\n%d\n",z+'A',max);
for(i=0;i<m;i++)
{
char * p;
p=a[i].zuozhe;
l=strlen(a[i].zuozhe);
for(k=0;k<l;k++)
{
if(p[k]=='A'+z)
printf("%d\n",a[i].bianhao);
}
}
break;
}
}
}
|
2 | 761 | //#define NULL 0
struct stu
{
int num;
char c[26];
struct stu *next;
};
struct stu* create(int m)
{
struct stu *p1,*p2,*xhead;
p1=(struct stu *)malloc(LEN);
scanf("%d %s",&p1->num,p1->c);
p2=p1;
xhead=p1;
while(m-1)
{
m--;
p1=(struct stu*)malloc(LEN);
scanf("%d %s",&p1->num,p1->c);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return xhead;
}
int stas(int b[])
{
int j,max=0,indexx=0;
for(j=0;j<26;j++)
if(b[j]>max)
{
max=b[j];
indexx=j;
}
printf("%c\n%d\n",indexx+65,max);
//for(j=0;j<26;j++)
//printf("%d ",b[j]);
return indexx;
}
struct stu* search(struct stu* yhead,int y)
{
struct stu *q;
int sum=0,k;
char *i;
char s[20],s0[20]={'\0'};
q=yhead;
while(q)
{
strcpy(s,q->c);
k=strlen(s);
for(i=s;i<i+k;i++)
if(*i==y+65)
sum++;
strcpy(s,s0);
q=q->next;
}
printf("%d\n",sum);
return 0;
}
struct stu* print(struct stu* zhead,int z)
{
struct stu* q;
int k;
char *i;
char s[20],s0[20]={'\0'};
q=zhead;
while(q)
{
strcpy(s,q->c);
k=strlen(s);
for(i=s;i<s+k;i++)
if(*i==z+65)
{
printf("%d\n",q->num);
break;
}
strcpy(s,s0);
q=q->next;
}
return 0;
}
int main()
{
int n,index;
int a[26],k,t,i;
char s[20],s0[20]={'\0'};
struct stu *p,*head;
memset(a,0,sizeof(a));
scanf("%d",&n);
head=create(n);
p=head;
while(p)
{
strcpy(s,p->c);
//printf("%s ",s);
k=strlen(s);
//printf("%d ",k);
for(i=0;i<k;i++)
{
//printf("%c ",s[i]);
t=s[i]-65;
a[t]++;
}
//for(t=0;t<26;t++)
//printf("%d ",a[t]);
strcpy(s,s0);
p=p->next;
}
index=stas(a);
//search(head,index);
print(head,index);
return 0;
}
|
2 | 762 | struct book
{
char num[500];
char s[50];
struct book *next;
};
void main()
{
struct book *head;
struct book *p1,*p2;
int m,mi,i,j,k,max,found;
int aut[26]={0};
scanf("%d",&m);
p1=(struct book*)malloc(LEN);
scanf("%s %s",p1->num,p1->s);
for(i=0;i<strlen(p1->s);i++)
aut[(p1->s)[i]-'A']++;
p1->next=NULL;
head=p2=p1;
for(mi=2;mi<=m;mi++)
{
p1=(struct book*)malloc(LEN);
scanf("%s %s",p1->num,p1->s);
for(i=0;i<strlen(p1->s);i++)
aut[(p1->s)[i]-'A']++;
p2->next=p1;
p2=p1;
}
p2->next=NULL;
max=0;
for(i=0;i<26;i++)
if(aut[i]>max)
{
k=i;
max=aut[i];
}
printf("%c\n",k+65);
printf("%d\n",aut[k]);
p1=head;
for(i=1;i<=m;i++)
{
found=0;
for(j=0;j<strlen(p1->s);j++)
if((p1->s)[j]==k+65)
{
found=1;
break;
}
if(found==1) printf("%s\n",p1->num);
p1=p1->next;
}
} |
2 | 763 | void main()
{
int a[100],i,l,c[26]={0},k,max,n,j;
char b[100][26],d[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],b[i]);
for(i=0;i<n;i++)
{
l=strlen(b[i]);
for(j=0;j<l;j++)
{
if(b[i][j]=='A')
c[0]++;
else if(b[i][j]=='B')
c[1]++;
else if(b[i][j]=='C')
c[2]++;
else if(b[i][j]=='D')
c[3]++;
else if(b[i][j]=='E')
c[4]++;
else if(b[i][j]=='F')
c[5]++;
else if(b[i][j]=='G')
c[6]++;
else if(b[i][j]=='H')
c[7]++;
else if(b[i][j]=='I')
c[8]++;
else if(b[i][j]=='J')
c[9]++;
else if(b[i][j]=='K')
c[10]++;
else if(b[i][j]=='L')
c[11]++;
else if(b[i][j]=='M')
c[12]++;
else if(b[i][j]=='N')
c[13]++;
else if(b[i][j]=='O')
c[14]++;
else if(b[i][j]=='P')
c[15]++;
else if(b[i][j]=='Q')
c[16]++;
else if(b[i][j]=='R')
c[17]++;
else if(b[i][j]=='S')
c[18]++;
else if(b[i][j]=='T')
c[19]++;
else if(b[i][j]=='U')
c[20]++;
else if(b[i][j]=='V')
c[21]++;
else if(b[i][j]=='W')
c[22]++;
else if(b[i][j]=='X')
c[23]++;
else if(b[i][j]=='Y')
c[24]++;
else if(b[i][j]=='Z')
c[25]++;
}
}
max=c[0];
for(i=0;i<26;i++)
if(c[i]>=max)
{
max=c[i];
k=i;
}
printf("%c\n",d[k]);
printf("%d\n",c[k]);
for(i=0;i<n;i++)
{
l=strlen(b[i]);
for(j=0;j<l;j++)
{
if(b[i][j]==d[k])
printf("%d\n",a[i]);
}
}
} |
2 | 764 | struct test {
int num;
int book[100];
}a[26];
int main() {
int n,i,j,index,temp,max;
char s[100];
char ch;
scanf("%d",&n);
for (i=0;i<26;i++) {
a[i].num=0;
}
for (i=0;i<n;i++) {
scanf("%d %s",&index,&s);
for (j=0;s[j]!='\0';j++) {
temp = (int)(s[j]-'A');
a[temp].book[a[temp].num]=index;
a[temp].num++;
}
}
max = 0;
for (i=0;i<26;i++) {
if (a[i].num>a[max].num)
max = i;
}
ch = (char)('A'+max);
printf("%c\n",ch);
printf("%d\n",a[max].num);
for (i=0;i<a[max].num;i++) {
printf("%d\n",a[max].book[i]);
}
return 0;
} |
2 | 765 | int main ()
{
int m;
scanf ("%d",&m);
int a[1000];
char s[1000][26];
int i,j;
for (i=0;i<m;i++)
{
scanf ("%d %s",&a[i],s[i]);
}
char x;
int max=0;
char maxx;int l;
for (x='A';x<='Z';x++)
{
l=0;
for (i=0;i<m;i++)
{
for (j=0;j<26;j++)
{
if (s[i][j]==x)break;
}
if (j!=26)l++;
}
if (l>max){max=l;maxx=x;}
}
printf ("%c\n%d\n",maxx,max);
for (i=0;i<m;i++)
{
for (j=0;j<26;j++)
{
if(s[i][j]==maxx)break;
}
if (j!=26)printf ("%d\n",a[i]);
}
return 0;
}
|
2 | 766 | 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 | 767 | struct {
int num;
char w[26];
}book[999],test[1];
int main(int argc, char* argv[])
{
int m,i,j,n,s;
char x,c;
scanf ("%d",&m);
for (i=0;i<m;i++)
{
scanf ("%d%s",&book[i].num,book[i].w);
}
x='A';
n=0;
c='A';
while (1)
{
s=0;
for (i=0;i<m;i++)
{
for (j=0;j<strlen(book[i].w);j++)
{
if (book[i].w[j]==x)
{s++;}
}
}
if (s>n)
{
n=s;
c=x;
}
if (x=='Z') {break;}
x++;
}
printf ("%c\n%d\n",c,n);
for (i=0;i<m;i++)
{
for (j=0;j<strlen(book[i].w);j++)
{
if (book[i].w[j]==c)
{
printf ("%d\n",book[i].num);
}
}
}
return 0;
}
|
2 | 768 | void main()
{
struct books
{
int num;
char author[26];
}books[999];
int n,a[26]={0},max,i,j,u,lenth,temp;
scanf ("%d",&n);
for (i=0;i<n;i++)
scanf("%d %s",&books[i].num,books[i].author);
for (i=0;i<n;i++)
{
lenth=strlen(books[i].author);
for (j=0;j<lenth;j++)
{
for (u=0;u<26;u++)
{
if (books[i].author[j]=='A'+u)
a[u]++;
}
}
}
temp=a[0];
for (u=0;u<26;u++)
if (a[u]>=temp)
{
max=u;
temp=a[u];
}
printf ("%c\n%d\n",'A'+max,a[max]);
for (i=0;i<n;i++)
{
lenth=strlen(books[i].author);
for (j=0;j<lenth;j++)
{
if (books[i].author[j]=='A'+max)
printf("%d\n",books[i].num);
}
}
}
|
2 | 769 | void main()
{
struct b
{
int num;
char str[27];
}b[100];
int n,i,m,j,max,nmax;
int a[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&b[i].num,b[i].str);
m=strlen(b[i].str);
for(j=0;j<m;j++)
{
a[b[i].str[j]-65]++;
}
}
max=a[0];
nmax=0;
for(i=0;i<26;i++)
{
if(a[i]>max) {max=a[i];nmax=i;}
}
printf("%c\n%d\n",nmax+65,max);
for(i=0;i<n;i++)
{
m=strlen(b[i].str);
for(j=0;j<m;j++)
{
if(b[i].str[j]==nmax+65)
printf("%d\n",b[i].num);
}
}
} |
2 | 770 | struct book
{
int id;
char peo[26];
}book1[999];
int main()
{
int n,i,j,m=0,num[26]={0},length,max=0,t;
char author;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%s",&book1[i].id,&book1[i].peo);
}
for(i=0;i<n;i++){
length=strlen(book1[i].peo);
for(j=0;j<length;j++){
num[(int)(book1[i].peo[j]-'A')]++;
}
}
for(i=0;i<26;i++){
if(num[i]>max){
max=num[i];
t=i;
author=i+'A';
}
}
printf("%c\n%d\n",author,num[t]);
for(i=0;i<n;i++){
length=strlen(book1[i].peo);
for(j=0;j<length;j++){
if(book1[i].peo[j]==author){
printf("%d\n",book1[i].id);
}
}
}
return 0;
}
|
2 | 771 | int main()
{
int i,j,num[1000],m,a[1000][26],k,sum[26],max=0,b;
char writer[1000][26],letter[27]={'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",&m);
for(k=0;k<26;k++)
{
sum[k]=0;
}
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
a[i][j]=0;
}
}
for(i=0;i<m;i++)
{
scanf("%d%s",&num[i],writer[i]);
}
for(k=0;k<26;k++)
{
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(writer[i][j]==letter[k])
{
a[i][k]++;
}
}
}
}
for(k=0;k<26;k++)
{
for(i=0;i<m;i++)
{
sum[k]=sum[k]+a[i][k];
}
}
for(k=0;k<26;k++)
{
if(max<sum[k])
{
max=sum[k];
b=k;
}
}
printf("%c\n%d\n",letter[b],max);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(writer[i][j]==letter[b])
{
printf("%d\n",num[i]);
}
}
}
return 0;
}
|
2 | 772 | struct x{
int num;
char author[26];
int amount;
};
void main(){
struct x y[999];
int i,j,m,max=0,max_=0;
int k;
int amount[91]={0};
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %s",&y[i].num,y[i].author);
y[i].amount=strlen(y[i].author);
}
for(i=0;i<m;i++){
for(j=0;j<y[i].amount;j++){
for(k='A';k<'Z';k++){
if(k=y[i].author[j]){
amount[k]++;
break;
}
}
}
}
for(i='A';i<'Z';i++){
if(max<amount[i]){
max=amount[i];
max_=i;//ASCII??max_?????????
}
}
printf("%c\n",max_);
printf("%d\n",max);
for(i=0;i<m;i++){
for(j=0;j<y[i].amount;j++){
if(y[i].author[j]==max_){
printf("%d\n",y[i].num);
}
}
}
} |
2 | 773 | int main()
{
int n,d,i,j,l;
struct a
{
char name[27];
int c;
}m[1000];
struct b
{
int num,book[1000];
char t;
};
struct b author[27];
for(i=1;i<=26;i++)
{
author[i].t=i+64;
}
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m[i].c);
scanf("%s",m[i].name);
}
for(i=1;i<=n;i++)
{
l=strlen(m[i].name);
for(j=0;j<=l-1;j++)
{
d=m[i].name[j]-64;
author[d].num++;
author[d].book[author[d].num]=m[i].c;
}
}
for(i=1;i<=25;i++)
{
if(author[i].num>author[i+1].num)
author[i+1]=author[i];
}
printf("%c\n",author[26].t);
printf("%d\n",author[26].num);
for(i=1;i<=author[26].num;i++)
{
printf("%d\n",author[26].book[i]);
}
return 0;
}
|
2 | 774 | 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 | 775 | int main()
{
int num[27] = {0};
int n, i, j, temp;
unsigned long len;
char author[27], temp2, book[27][1000] = {'\0'};
char str[4];
cin >> n;
for (i = 0; i < n; i++)
{
cin >> str; //??????
cin.get();
cin.getline(author, 27);
len = strlen(author); //???unsigned long ?????????????
for (j = 0; j < len; j++)
{
num[author[j] - 'A']++;
strncat(book[author[j] - 'A'], str, 3); //??????????????????
}
}
temp = 0;
for (j = 0; j < 26; j++)
{
if (num[j] > temp)
{
temp = num[j];
temp2 = j + 'A';
}
}
cout << temp2 << endl << temp << endl;
for (j = 0; j < temp; j++)
{
for (i = 0; i < 3; i++)
cout << book[temp2 - 'A'][j * 3 + i]; //??temp2 - 'A'??? temp?j*3 + i ??j + i
cout << endl;
}
return 0;
} |
2 | 776 | void main ()
{
int n,a[1000],i,l,j,max,s[26]={0};
char c[1000][27],w;
scanf ("%d",&n);
for (i=0;i<n;i++)
{
scanf ("%d%s",&a[i],c[i]);
l=strlen(c[i]);
for (j=0;j<l;j++)
{
s[c[i][j]-65]++;
}
}
max=s[0];
w='A';
for (i=1;i<26;i++)
{
if (s[i]>max)
{
max=s[i];
w=i+65;
}
}
printf ("%c\n%d\n",w,max);
for (i=0;i<n;i++)
{
for (j=0;c[i][j]!='\0';j++)
{
if (c[i][j]==w)
{
printf ("%d\n",a[i]);
break;
}
}
}
}
|
2 | 777 | int main()
{
int n,i,j,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(j=0;k[i][j]!='\0';j++)
{
author[k[i][j]-'A'+1]++;
}
}
int max=0;
for(i=1;i<=26;i++)
{
if(author[i]>max)
{
max=author[i];
maxnumber=i;
}
}
char who;
who='A'+maxnumber-1 ;
printf("%c\n",who);
printf("%d\n",max);
for(i=1;i<=n;i++)
{
for(l=0;l<=strlen(k[i]);l++)
if(k[i][l]==who)
printf("%d\n",a[i]);
}
return 0;
} |
2 | 778 |
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 | 779 | 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 | 780 | main()
{
int amount_temp=0,amount_most=0;
char most,temp;
int i,j,k,s,p;
int m;
char jiancha[27];
struct xinxi
{
int bianhao;
char zuozhe[27];
};
struct xinxi shuru[999];
scanf("%d",&m);
for(p=0;p<m;p++)
{
scanf("%d %s",&shuru[p].bianhao,shuru[p].zuozhe);
}
for(temp='A';temp<='Z';temp++)
{
for(i=0;i<m;i++)
{
strcpy(jiancha,shuru[i].zuozhe);
for(j=0;j<strlen(jiancha);j++)
{
if(jiancha[j]==temp)
{
amount_temp++;
}
}
}
if(amount_temp>amount_most)
{
amount_most=amount_temp;
most=temp;
amount_temp=0;
}
else
{
amount_temp=0;
}
}
printf("%c\n%d\n",most,amount_most);
for(i=0;i<m;i++)
{
strcpy(jiancha,shuru[i].zuozhe);
for(j=0;j<strlen(jiancha);j++)
{
if(jiancha[j]==most)
{
printf("%d\n",shuru[i].bianhao);
break;
}
}
}
}
|
2 | 781 | int a[26]={0} ;int n;int max;int hao;
struct chushu
{
int num;
char s[30];
struct chushu *next;
};
struct chushu *create()
{
int j=0,q,i=0,k=0;
struct chushu *head,*p1,*p2;
p1=(struct chushu *)malloc(len);
scanf("%d %s",&p1->num,p1->s);
for (i=0;p1->s[i]!='\0';i++)
{
j=p1->s[i]-65;
a[j]=a[j]+1;
}
head=p1;p2=p1;
while(k<n-1)
{
k++;
p2=p1;
p1=(struct chushu *)malloc(len);
scanf("%d %s",&p1->num,p1->s);
for (i=0;p1->s[i]!='\0';i++)
{
j=p1->s[i]-65;
a[j]=a[j]+1;
}
p2->next=p1;
}
p2=p1;
p2->next=NULL;
return (head);
}
/*void print(struct chushu *head)
{
struct chushu *p;
p=head;
while(p!=NULL)
{printf("%d\n",p->num);
p=p->next;}
}*/
void search(struct chushu *head)
{
int i;
struct chushu *p;
p=head;
while (p->next!=NULL)
{
for (i=0;p->s[i]!='\0';i++)
{
if (hao+65==p->s[i])
printf("%d\n",p->num);
}
p=p->next;
}
for (i=0;p->s[i]!='\0';i++)
{
if (hao+65==p->s[i])
printf("%d\n",p->num);
}
}
void main()
{
int i;
struct chushu *p;
scanf("%d",&n);
p=create();
max=0;
//print(p);
for (i=0;i<26;i++)
{
if (a[i]>max)
{
max=a[i];
hao=i;
}
}
printf("%c\n",hao+65);
printf("%d\n",max);
search(p);
}
|
2 | 782 | void main()
{
int t=0,m,i,j,n,k,a[999],c[26]={0};
char b[999][999];
scanf("%d\n",&m);
for(i=0;i<m;i++)
scanf("%d %s",&a[i],b[i]);
for(i=0;i<m;i++)
{
k=strlen(b[i]);
for(j=0;j<k;j++)
c[b[i][j]-'A']++;
}
for(j=0;j<26;j++)
{
if(t<c[j])
t=c[j];
}
for(i=0;i<26;i++)
{
if(c[i]==t)
{ printf("%c\n",i+'A');
break;
}
}
printf("%d\n",t);
for(j=0;j<m;j++)
{
k=strlen(b[j]);
for(n=0;n<k;n++)
{ if((b[j][n]-'A')==i)
printf("%d\n",a[j]);
}
}
} |
2 | 783 | struct book
{
int num;
char aut[26];
}bo[999];
main()
{
int n,i,j,k,count[26],max;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&bo[i].num,&bo[i].aut);
}
for(i=0;i<26;i++)
count[i]=0;
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(bo[i].aut[j]-65>=0&&bo[i].aut[j]-65<26)
count[bo[i].aut[j]-65]++;
}
}
max=0;
for(i=0;i<26;i++)
{
if(count[i]>max)
{max=count[i];k=i;}
}
printf("%c\n%d\n",k+65,max);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(bo[i].aut[j]-65==k)
printf("%d\n",bo[i].num);
}
}
} |
2 | 784 | int main()
{
int m,i,j,k,a[1000],c[91],max=0;
char b[1000][26],d;
cin>>m;
memset(c,0,sizeof(c));
for(i=0;i<m;i++)
{
cin>>a[i]>>b[i];
for(j=0;j<26;j++)
if(b[i][j]>0)
c[b[i][j]]++;
}
for(i=65;i<91;i++)
if(c[i]>max)
max=c[i];
for(i=65;i<91;i++)
if(c[i]==max)
{
d=i;
cout<<d<<endl<<max<<endl;
for(j=0;j<m;j++)
for(k=0;k<26;k++)
if(b[j][k]==d)
{
cout<<a[j]<<endl;
break;
}
}
return 0;
} |
2 | 785 |
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 | 786 | void main()
{
struct book
{
int x;
char z[10];
}a[400];
int i,n,max=0,j,k,l,y[400],p;char u;scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i].x,a[i].z);y[i]=strlen(a[i].z);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<y[i];j++)
{
p=1;
for(k=i+1;k<n;k++)
{
for(l=0;l<y[k];l++)
if(a[i].z[j]==a[k].z[l])p++;
}
if(p>max){max=p;u=a[i].z[j];}
}
}
printf("%c\n%d\n",u,max);
for(i=0;i<n;i++)
{
for(j=0;j<y[i];j++)
if(u==a[i].z[j]){printf("%d\n",a[i].x);break;}
}
}
|
2 | 787 | int main()
{
int n,book[1000],cnt[60],max;
char author[1000][26],p;
int b[60][1000];
cin>>n;
for(int i=0;i<60;i++)
cnt[i]=0;
for(int i=0;i<n;i++)
{
cin>>book[i];
cin.get();
cin.getline(author[i],26);
}
for(int i=0;i<n;i++)
{
for(int j=0;author[i][j]!='\0';j++)
{
int k=author[i][j]-'0';
b[k][cnt[k]++]=book[i];//?i???K????
}
}
max=cnt[17];
p='A';
for(int i=17;i<=42;i++)
{
if(cnt[i]>max)
{
max=cnt[i];
p=i+'0';
}
}
cout<<p<<endl;
cout<<max<<endl;
for(int m=0;m<max;m++)
cout<<b[p-'0'][m]<<endl;
return 0;
}
|
2 | 788 | 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 | 789 | int main()
{
int m,i,j;
scanf("%d",&m);
struct Bookinfo
{
int number;
char auther[27];
};
struct Bookinfo a[1000];
for (i=0;i<m;i++)
scanf("%d %s",&a[i].number,a[i].auther);
int count[26]={0},max,record;
for (i=0;i<m;i++)
{
int k;
k=strlen(a[i].auther);
for (j=0;j<k;j++)
{
count[a[i].auther[j]-'A']++;
}
}
max=count[0];
for (i=0;i<26;i++)
if (count[i]>=max)
{
max=count[i];
record=i;
}
printf("%c\n%d\n",record+'A',max);
for (i=0;i<m;i++)
{
int n;
n=strlen(a[i].auther);
for (j=0;j<n;j++)
if (a[i].auther[j]==record+'A')
{
printf("%d\n",a[i].number);
break;
}
}
}
|
2 | 790 | int main()
{
int n,i,j,k,t=0,c=0;
int A[25];
char g[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct point{
int a;
char s[80];
}tope[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&tope[i].a,tope[i].s);
}
for(k=0;k<26;k++)
{
A[k]=0;
for(i=0;i<n;i++){
for(j=0;tope[i].s[j]!='\0';j++)
{
if(tope[i].s[j]==g[k])
{
A[k]++;
}
}
}
}
for(i=0;i<26;i++)
{
if(A[i]>t)
{
t=A[i];
c=i;
}
}
printf("%c\n%d\n",g[c],t);
for(i=0;i<n;i++)
{
for(j=0;tope[i].s[j]!='\0';j++)
{
if(tope[i].s[j]==g[c])
{
printf("%d\n",tope[i].a);
}
}
}
return 0;
}
|
2 | 791 | int main()
{
int n,amount[26],num[26][1000],num0,max=0;
char a;
memset(amount,0,sizeof(amount));
cin>>n;
for(int i=0;i<n;i++)
{
cin>>num0;
cin.get();
a=cin.get();
while(a!='\n')
{
num[a-65][amount[a-65]]=num0;
amount[a-65]++;
a=cin.get();
}
}
for(int i=0;i<26;i++)
if(max<amount[i])
max=amount[i];
for(int i=0;i<26;i++)
if(max==amount[i])
{
a=i+65;
cout<<a<<endl<<max<<endl;
for(int j=0;j<max;j++)
cout<<num[i][j]<<endl;
break;
}
return 0;
} |
2 | 792 | void main()
{
struct book
{
int num;
char name[26];
};
int m,i,j,max;
int sum[26]={0};
scanf("%d",&m);
struct book b[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++)
sum[(b[i].name)[j]-'A']++;
}
max=0;
for(i=1;i<26;i++)
if(sum[i]>sum[max])max=i;
printf("%c\n%d\n",max+'A',sum[max]);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(b[i].name);j++)
{
if((b[i].name)[j]==65+max)
printf("%d\n",b[i].num);
}
}
}
|
2 | 793 |
int main(int argc, char* argv[])
{char s[999][3][27];
int m,i,j,k,Nn[27],ctrl;
/*11111*/
scanf("%d",&m);
for(k=1;k<=m;k++){
scanf("%s",s[k][1]);
scanf("%s",s[k][2]);
}
/*2222*/
for(i=1;i<=26;i++)
Nn[i]=0;
for(i=1;i<=m;i++){
for(j=0;s[i][2][j]!='\0';j++){
if(s[i][2][j]=='A')Nn[1]++;
else if(s[i][2][j]=='B')Nn[2]++;
else if(s[i][2][j]=='C')Nn[3]++;
else if(s[i][2][j]=='D')Nn[4]++;
else if(s[i][2][j]=='E')Nn[5]++;
else if(s[i][2][j]=='F')Nn[6]++;
else if(s[i][2][j]=='G')Nn[7]++;
else if(s[i][2][j]=='H')Nn[8]++;
else if(s[i][2][j]=='I')Nn[9]++;
else if(s[i][2][j]=='J')Nn[10]++;
else if(s[i][2][j]=='K')Nn[11]++;
else if(s[i][2][j]=='L')Nn[12]++;
else if(s[i][2][j]=='M')Nn[13]++;
else if(s[i][2][j]=='N')Nn[14]++;
else if(s[i][2][j]=='O')Nn[15]++;
else if(s[i][2][j]=='P')Nn[16]++;
else if(s[i][2][j]=='Q')Nn[17]++;
else if(s[i][2][j]=='R')Nn[18]++;
else if(s[i][2][j]=='S')Nn[19]++;
else if(s[i][2][j]=='T')Nn[20]++;
else if(s[i][2][j]=='U')Nn[21]++;
else if(s[i][2][j]=='V')Nn[22]++;
else if(s[i][2][j]=='W')Nn[23]++;
else if(s[i][2][j]=='X')Nn[24]++;
else if(s[i][2][j]=='Y')Nn[25]++;
else if(s[i][2][j]=='Z')Nn[26]++;
}
}
/*33333*/int Nmax=0,zimuxu;
for(i=1;i<=26;i++){
if (Nn[i]>Nmax){Nmax=Nn[i];zimuxu=i;}
}
/*4444444*/
printf("%c\n",'A'+zimuxu-1);
printf("%d\n",Nmax);
/*5555*/
for(j=1;j<=m;j++){
ctrl=0;
for(k=0;s[j][2][k]!='\0';k++){
if(s[j][2][k]=='A'+zimuxu-1)ctrl++;
}
if(ctrl!=0)printf("%s\n",s[j][1]);
}
return 0;
}
|
2 | 794 | 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 | 795 | struct book
{
int a;
char b[30];
struct book *next;
};
void main()
{
int i,k,m,max=0,t;
char j,ch;
struct book *head,*p1,*p2;
scanf("%d",&m);
p1=(struct book*)calloc(1,sizeof(struct book));
head=p1;
for(i=0;i<m;i++)
{
scanf("%d %s",&(p1->a),p1->b);
p2=p1;
if(i==m-1)
p2->next=NULL;
else
{
p1=(struct book*)calloc(1,sizeof(struct book));
p2->next=p1;
}
}
for(j='A';j<='Z';j++)
{
t=0;
p1=head;
while(p1)
{
for(k=0;k<strlen(p1->b);k++)
if((p1->b)[k]==j)
t++;
p1=p1->next;
}
if(t>max)
{
max=t;
ch=j;
}
}
printf("%c\n",ch);
printf("%d\n",max);
p1=head;
while(p1)
{
for(k=0;k<strlen(p1->b);k++)
if((p1->b)[k]==ch)
printf("%d\n",p1->a);
p1=p1->next;
}
} |
2 | 796 |
struct books{
int num;
char writer[26];
struct books *next;
};
int m;
struct books *creat()
{
struct books *head,*p1,*p2;
int i;
p2=p1=(struct books*)malloc(sizeof(struct books));
for (i=1;i<=m;i++){
if (i==1) head=p1;
scanf("%d %s",&p1->num,p1->writer);
p2=p1;
if(i!=m){
p1=(struct books*)malloc(sizeof(struct books));
p2->next=p1;
}
else p2->next=NULL;
}
return head;
}
void main()
{
int character[26];
struct books *head,*p;
int i,max=0,imax;
for (i=0;i<26;i++) character[i]=0;
scanf("%d",&m);
head=creat();
p=head;
while(1){
i=0;
while(*(p->writer+i)){
character[*(p->writer+i)-'A']++;
i++;
}
p=p->next;
if(p==NULL) break;
}
for (i=0;i<26;i++){
if (character[i]>max){
max=character[i];
imax=i;
}
}
printf("%c\n%d\n",imax+'A',max);
p=head;
while(1){
i=0;
while(*(p->writer+i)){
if(*(p->writer+i)==imax+'A'){
printf("%d\n",p->num);
break;
}
i++;
}
p=p->next;
if(p==NULL) break;
}
}
|
2 | 797 | struct book{
int num;
char s[27];
}shu[1000];
int main(){
int n,i,l,j,max;
char name;
int letter[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%s",&shu[i].num,&shu[i].s);
l=strlen(shu[i].s);
for(j=0;j<l;j++){
letter[(shu[i].s[j]-65)]++;
}
}
for(max=letter[0],name=65,i=1;i<26;i++){
if(letter[i]>max){
max=letter[i];
name=i+65;
}
}
printf("%c\n%d\n",name,max);
for(i=0;i<n;i++){
l=strlen(shu[i].s);
for(j=0;j<l;j++){
if(shu[i].s[j]==name){
printf("%d\n",shu[i].num);
}
}
}
return 0;
} |
2 | 798 | int w[26]={0};//zimu 0 26
int p=0;
void zimu(char a[]){
int m,i,j;
char c;
m=strlen(a);
for(j=0;j<26;j++){
c='A'+j;
for(i=0;i<m;i++){
if(a[i]==c)
w[j]++;
}
}//for1 end
}
int max(int w[26]){
int i,max;
max=w[0];
for(i=1;i<26;i++)
if(w[i]>max){
max=w[i];
p=i;
}
return max;
}
void main(){
char b[300][20];
int a[300];
int m,i,j,mm;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&a[i],b[i]);
for(i=0;i<m;i++)
zimu(b[i]);
mm=max(w);
printf("%c\n",p+'A');
printf("%d\n",mm);
for(i=0;i<m;i++){
for(j=0;j<(strlen(b[i]));j++)
if(b[i][j]==(p+'A')){
printf("%d\n",a[i]);
break;
}
}
}
|
2 | 799 | struct author
{ int num;
char name[26];
};
struct author ren[100];
int main()
{ int n,i,j=0,k=0,biao,maxzuozhe,p,geshu[26]={0},max=0,maxdeshu[999];
scanf("%d\n",&n);
for(i=0;i<=n-1;i++)
{ scanf("%d",&ren[i].num);
scanf("%s",ren[i].name);
}
for(i=0;i<=25;i++)
{ for(j=0;j<=n-1;j++)
{
for(k=0;k<=strlen(ren[j].name);k++)
{ if((i+'A')==ren[j].name[k])
geshu[i]=geshu[i]+1;
}
}
}
for(i='A'-65;i<='Z'-65;i++)
{ if(max<geshu[i])
{max=geshu[i];
biao=i;}
}
maxzuozhe='A'+biao;
p=0;
for(i=0;i<=n-1;i++)
{ for(k=0;k<=strlen(ren[i].name);k++)
{ if(maxzuozhe==ren[i].name[k])
{maxdeshu[p]=ren[i].num;
p++;
break;}
}
}
printf("%c\n",maxzuozhe);
printf("%d\n",p);
for(i=0;i<=p-1;i++)
printf("%d\n",maxdeshu[i]);
getchar();
} |