id
int32 0
32.5k
| code
stringlengths 95
8.4k
| label
stringclasses 65
values |
---|---|---|
500 | void main()
{
int n,len,i,j,k,max;
int c[26]={0};
char a[26],f,x;
struct book{ int num; char author[26];};
struct book b[1000];
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%d %s",&b[i].num,&b[i].author);
for(i=0;i<n;i++)
{
strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if('A'<=(x=a[j])&&(x=a[j])<='Z')
c[x-'A']++;
}
max=c[0];k=0;
for(i=0;i<26;i++)
{if(c[i]>max)
{max=c[i];
k=i;
}}
printf("%c\n%d\n",k+'A',max);
for(i=0;i<n;i++)
{
strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if((f=a[j])==k+'A')
printf("%d\n",b[i].num);
}
} | 2 |
501 | struct book
{
int num;
char writer[27];
struct book *next;
};
int n;
int time[26]={0},max,k;
struct book *create(int m)
{
struct book *head;
struct book *p1,*p2;
n=0;
p1=p2=(struct book *)malloc(LEN);
head=NULL;
while(n<m)
{
scanf("%d %s",&p1->num,p1->writer);
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
}
p2->next=NULL;
return (head);
}
void search(struct book *head)
{
int i;
struct book *p;
p=head;
if(head!=NULL)
{
do
{
for(i=0;(p->writer)[i]!='\0';i++)
time[(p->writer)[i]-'A']++;
p=p->next;
}
while(p!=NULL);
}
}
void pr(struct book *head)
{
int i;
struct book *p;
p=head;
if(head!=NULL)
{
do
{
for(i=0;(p->writer)[i]!='\0';i++)
{
if((p->writer)[i]=='A'+k)
printf("%d\n",p->num);
}
head = p;
p=p->next;
free(head);
}
while(p!=NULL);
}
}
void main()
{
int m,i;
scanf("%d",&m);
struct book *head;
head=create(m);
search(head);
max=time[0];
k=0;
for(i=1;i<26;i++)
{
if(time[i]>max)
{
max=time[i];
k=i;
}
}
printf("%c\n%d\n",'A'+k,max);
pr(head);
}
| 2 |
502 | struct book
{
int num;
char au[32];
int sta[27];
}b[1020];
int main()
{
int i,j,k,m,n;
char c;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&b[i].num,b[i].au);
}
for(i=0;i<m;i++)
{
//scanf("%d %s",&b[i].num,&b[i].au);
for(j=0;;j++)
{
c=b[i].au[j];
if(c=='\0')
{
break;
}
else
{
b[i].sta[c-64]++;
}
}
}
int sum[27]={0};
for(i=0;i<m;i++)
{
for(j=1;j<27;j++)
{
sum[j]+=b[i].sta[j];
}
}
int max=0;
for(i=1;i<27;i++)
{
if(sum[i]>max)
{
max=sum[i];
k=i;
}
}
printf("%c\n",k+64);
n=0;
for(i=0;i<m;i++)
{
if(b[i].sta[k]!=0)
{
n++;
}
}
printf("%d\n",n);
n=0;
for(i=0;i<m;i++)
{
if(b[i].sta[k]!=0)
{
n++;
if(n==1)
{
printf("%d",b[i].num);
}
else
{
printf("\n%d",b[i].num);
}
}
}
return 0;
} | 2 |
503 |
struct BOOK
{
int num;
char name[26];
int name_num[26];
}book[999];
void main()
{
int n; //????//
scanf("%d",&n);
int i;
for(i=0;i<n;i++){
scanf("%d%s",&book[i].num,&book[i].name); //??????????????????i??j????????????//
}
int count[26]={0};
int k;
for(i=0;i<n;i++){
int len;
len=strlen(book[i].name);
for(k=0;k<len;k++){
book[i].name_num[k]=(int)book[i].name[k];
}
}
int j;
int y;
for(i=0;i<n;i++){
int len_1;
len_1=strlen(book[i].name);
for(j=65;j<=90;j++){
for(y=0;y<len_1;y++){
if(book[i].name_num[y]==j){
count[j-65]++;
}
}
}
}
int w;
int max=count[0];
int t=0;
for(w=0;w<26;w++){
if(count[w]>max){
max=count[w];
t=w;
}
}
printf("%c\n%d\n",t+65,max);
int x;
int total=0;
for(i=0;i<n;i++){
int length;
length=strlen(book[i].name);
for(x=0;x<length;x++){
if(book[i].name_num[x]==t+65){
printf("%d\n",book[i].num);
}
}
}
} | 2 |
504 | void main()
{
int n,i,j,max=0,seq=0;
int a[26]={0};
scanf("%d",&n);
struct book
{
int num;
char str[26];
}book[999];
for(i=0;i<n;i++)
scanf("%d %s",&book[i].num,&book[i].str);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
a[(book[i].str[j]-65)]++;
}
for(i=0;i<26;i++)
if (a[i]>max) {max=a[i];seq=i;}
printf("%c\n",seq+65);
printf("%d\n",max);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
if (book[i].str[j]==seq+65) {printf("%d\n",book[i].num); break;}
}
}
| 2 |
505 | 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 |
506 | struct book
{
int id;
char author[26];
};
int main()
{
struct book b[999];
int a[26];
int m,i,j,max,maxauthor;
char c;
scanf("%d",&m);
for (i=0;i<m;i++)
{
scanf("%d %s",&b[i].id,b[i].author);
}
for (i=0;i<26;i++)
{
a[i]=0;
}
for (i=0;i<m;i++)
{
for (j=0;b[i].author[j]!='\0';j++)
{
c=b[i].author[j];
a[c-65]++;
}
}
max=a[0];
maxauthor=0;
for (i=1;i<26;i++)
{
if (a[i]>max)
{
max=a[i];
maxauthor=i;
}
}
printf("%c\n%d\n",maxauthor+65,max);
for (i=0;i<m;i++)
{
for (j=0;b[i].author[j]!='\0';j++)
{
c=b[i].author[j];
if (c==maxauthor+65)
{
printf("%d\n",b[i].id);
break;
}
}
}
return 0;
} | 2 |
507 | 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 |
508 | 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 |
509 | char zimu[28]="ABCDEFGJIJKLMNOPQRSTUVWXYZ";
char writer[10000][10000];
int times[26],id[1000],i,len[10000],book=0;
int n,j,k,tmax,max=0;
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&id[i],&writer[i]);
len[i]=strlen(writer[i]);
}
for(i=0;i<26;i++)
{
times[i]=0;
}
for(i=0;i<n;i++)
{
for(j=0;j<len[i];j++)
{
for(k=0;k<26;k++)
{
if(writer[i][j]==zimu[k])
{times[k]++;}
}
}
}
for(i=0;i<26;i++)
{
if(times[i]>max)
{ max=times[i];
tmax=i;
}}
printf("%c\n",zimu[tmax]);
for(i=0;i<n;i++)
{
for(j=0;j<len[i];j++)
{
if(writer[i][j]==zimu[tmax])
{book++;}
}
}
printf("%d\n",book);
for(i=0;i<n;i++)
{
for(j=0;j<len[i];j++)
{
if(writer[i][j]==zimu[tmax])
{printf("%d\n",id[i]);}
}
}
return 0;
} | 2 |
510 | 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 |
511 |
struct book{
int num;
char author[26];
};
char max(int *p);
int main()
{
int m,b,i,*p;
struct book shu[999];
char c;
int writer[26];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d%s",&shu[i].num,shu[i].author);
}
for(c='A',writer[c-'A']=0;c<='Z';c++){
writer[c-'A']=0;
for(i=0;i<m;i++){
for(b=0;shu[i].author[b]!='\0';b++){
if(c==shu[i].author[b]){
writer[c-'A']++;
}
}
}
}
p=writer;
printf("%c\n%d\n",max(p),writer[max(p)-'A']);
for(i=0;i<m;i++){
for(b=0;shu[i].author[b]!='\0';b++){
if(max(p)==shu[i].author[b]){
printf("%d\n",shu[i].num);
}
}
}
return 0;
}
char max(int *p)
{
int i;
char max;
for(i=0,max='A';i<26;i++){
if(*(p+i)>*(p+max-'A')){
max=i+'A';
}
}
return max;
}
| 2 |
512 |
struct book{
int num;
char aut[100];
}b[200000];
int count[1000]={0};
int main()
{
int n,max=0,maxnum,i,j,f;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d %s", &b[i].num, b[i].aut);
for(j=0;j<strlen(b[i].aut);j++){count[b[i].aut[j]]++;}
}
for(i='A';i<='Z';i++){
if(count[i]>max){
max=count[i];
maxnum=i;
}
}
printf("%c\n%d\n", maxnum, max);
for(i=1;i<=n;i++){
f=0;
for(j=0;j<strlen(b[i].aut);j++){
if(b[i].aut[j]==maxnum){f=1;}
}
if(f==1){printf("%d\n", b[i].num);}
}
return 0;
}
| 2 |
513 |
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 |
514 | void main()
{char c;
int max=0,store,m,i,x[26][1000]={0},coun[27]={0},flag;
scanf("%d", &m);
for (i=1;i<=m;i++)
{scanf("%d ", &store);
for (;;)
{scanf("%c", &c);
if (c<65||c>90)
break;
else {x[c-64][i]=store;coun[c-64]++;}}
}
for (i=1;i<=26;i++)
{if (coun[i]>max)
{max=coun[i];
flag=i+64;
}
}
printf("%c\n", flag);
printf("%d\n", coun[flag-64]);
for (i=1;i<=1000;i++)
{if (x[flag-64][i]!=0)
printf("%d\n", x[flag-64][i]);
}
} | 2 |
515 | 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 |
516 | int main()
{ char p=0;
int m,i,j,max[1000];
struct book{
int num;
char s[27];
} book[1000];
memset(max,0,sizeof(max));
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&book[i].num,book[i].s);}
for(i=0;i<m;i++)
{for(j=0;book[i].s[j];j++)
{ if(++max[book[i].s[j]]>max[p])
p=book[i].s[j];
}}
printf("%c\n%d\n",p,max[p]);
for(i=0;i<m;i++)
{if(strchr(book[i].s,p))
printf("%d\n",book[i].num);}
return 0;
} | 2 |
517 |
struct book
{
int num;
char writer[100];
};
void main()
{
int n,i,j,a[26],c[100],k,t,d[100],s;
struct book bo[100];
for(i=0;i<26;i++)
a[i]=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&bo[i].num);
scanf("%s",bo[i].writer);
}
for(i=0;i<n;i++)
{
c[i]=strlen(bo[i].writer);
for(j=0;j<c[i];j++)
{
k=bo[i].writer[j]-'A';
a[k]++;
}
}
t=a[0];
j=0;
for(i=1;i<26;i++)
{
if(a[i]>t)
{
j=i;
t=a[i];
}
}
s=j;
printf("%c\n",'A'+j);
printf("%d\n",t);
for(i=0;i<n;i++)
{
d[i]=0;
for(j=0;j<c[i];j++)
{
if(bo[i].writer[j]==('A'+s))
d[i]=1;
}
if(d[i]==1)
printf("%d\n",bo[i].num);
}
}
| 2 |
518 | int main()
{
int i,j,n,k,c,big=0;
int num[30]={0},a[1000];
char name[1000][20];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i],name[i]);
}
for(k=0;k<26;k++)
{
for(i=0;i<n;i++)
{
for(j=0;j<strlen(name[i]);j++)
{
if(name[i][j]==k+'A')
num[k]=num[k]+1;
}
}
}
for(i=0;i<26;i++)
{
if(big<num[i])
{big=num[i];
c=i+'A';
}
}
printf("%c\n",c);
printf("%d\n",big);
/* for(i=0;i<n;i++)
{
if(num[i]==big)
printf("%d\n",big);
}*/
for(i=0;i<n;i++)
{
for(j=0;j<strlen(name[i]);j++)
{
if(name[i][j]==c)
printf("%d\n",a[i]);
}
}
return 0;
}
| 2 |
519 | struct m
{ int no,j;
char a[27];
}
main()
{ int n,k,i,j,no,ath[26]={0},m;
char *t,a[26];
struct m *head,*p1,*p2,*tp,*q;
scanf("%d",&n);
head=(struct m*)calloc(n,L);
for(i=0;i<n;i++)
{ scanf("%d%s",&(head+i)->no,(head+i)->a);
(head+i)->j=0;
for(t=(head+i)->a;*t!='\0';t++)
{
ath[*t-'A']++;
}
}
for(m=ath[0],k=0,i=1;i<26;i++)
{ if(ath[i]>m){k=i;m=ath[i];}
}
printf("%c",'A'+k);
m=0;
for(i=0;i<n;i++)
{ for(t=(head+i)->a;*t!='\0';t++)
if(*t==('A'+k))
{ (head+i)->j=1;
m++;
break;
}
}
printf("\n%d\n",m);
for(i=0;i<n;i++)
{ if((head+i)->j==1){
printf("%d",(head+i)->no);
m--;
if(m>0)printf("\n");}
}
} | 2 |
520 | int main()
{
int m,n=0,book[1000],num[26]={0};
char name[1000][10];
cin>>m;
for(int i=1;i<=m;i++)
{
cin>>book[i]>>name[i];
}
for(char z='A';z<='Z';z++)
{
for(int i=1;i<=m;i++)
{
for(int j=0;j<10;j++)
if(name[i][j]==z)num[z-'A']++;
}
}
int max=0,k=0;
for(int i=0;i<26;i++)
{ if(max<num[i]){max=num[i];k=i;}}
cout<<(char)('A'+k)<<endl<<max<<endl;
for(int i=1;i<=m;i++)
{
for(int j=0;j<10;j++)
if(name[i][j]=='A'+k)cout<<book[i]<<endl;
}
return 0;
} | 2 |
521 | struct book
{
int num;
char edt[27];
};
struct total //??????????????
{
char name;
int amount;
};
int main()
{
int m,i,j,k;
struct book bk[1000];
struct total to[27];
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&bk[i].num,bk[i].edt);
for(i=0;i<26;i++)
{
to[i].name='A'+i;//????26???
to[i].amount=0;
}
//???????????
for(i=0;i<m;i++)
{
for(j=0;j<strlen(bk[i].edt);j++)
{
for(k=0;k<26;k++)
{
if(bk[i].edt[j]==to[k].name)
to[k].amount ++;
}
}
}
//???????????????to[k]??
for(i=k=0;i<26;i++)
{
if(to[i].amount>to[k].amount )
k=i;
}
printf("%c\n%d\n",to[k].name ,to[k].amount );
//??????????
for(i=0;i<m;i++)
{
for(j=0;j<strlen(bk[i].edt);j++)
if(bk[i].edt[j]==to[k].name)
printf("%d\n",bk[i].num);
}
return 0;
} | 2 |
522 | 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 |
523 | void main()
{
struct book
{
int n;
char a[26];
};
struct book book[999];
int m,c[26]={0},k;
char w[26];
scanf("%d",&m);
int i,j,max=0,t;
for(i=0;i<m;i++)
scanf("%d %s",&book[i].n,book[i].a);
for(i=0;i<26;i++)
w[i]='A'+i;
for(i=0;i<26;i++)
for(j=0;j<m;j++)
for(k=0;k<26;k++)
{
if(book[j].a[k]==w[i])
c[i]++;
}
for(i=0;i<26;i++)
{
if(c[i]>max)
max=c[i];
}
for(i=0;i<26;i++)
{
if(c[i]==max)
{t=i;
break;}
}
printf("%c\n%d\n",w[t],c[t]);
for(j=0;j<m;j++)
for(k=0;k<26;k++)
{
if(book[j].a[k]==w[t])
{ printf("%d\n",book[j].n);
break;}
}
} | 2 |
524 | struct book
{char name[26];
int number;
}a[1000];
void main()
{
int n,i,j,b[26]={0},max=0,t;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i].number,a[i].name);
for(i=0;i<n;i++)
for(j=0;a[i].name[j]!='\0';j++)
b[a[i].name[j]-65]++;
for(i=0;i<26;i++)
if(max<b[i])
max=b[i];
for(i=0;i<26;i++)
if(max==b[i])
{
t=i;
break;
}
printf("%c\n%d\n",t+65,b[t]);
for(i=0;i<n;i++)
for(j=0;a[i].name[j]!='\0';j++)
if(a[i].name[j]==t+65)
{
printf("%d\n",a[i].number);
break;
}
}
| 2 |
525 | int main()
{
int n,len,i,j,book[1000],num[26]={0},k=0,t,m=0;
char w[1000][27],c='A';
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i],w[i]);
len=strlen(w[i]);
for(j=0;j<len;j++)
{
for(c='A',t=0;c<='Z';c++)
{
if(w[i][j]==c)
{
num[t]++;
break;
}
t++;
}
}
}
for(i=0;i<26;i++)
{
if(num[i]>m)
{
m=num[i];
k=i;
}
}
c='A'+k;
printf("%c\n",c);
printf("%d\n",num[k]);
for(i=0;i<n;i++)
{
len=strlen(w[i]);
for(j=0;j<len;j++)
{
if(w[i][j]==c)
{
printf("%d\n",book[i]);
break;
}
}
}
return 0;
}
| 2 |
526 |
void main()
{
int i,j,k,n,m,sum=0,min,max,ID[1000]={0},a[26]={0};
char name[1000][26]={""};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&ID[i],&name[i]);
for(i=0;i<n;i++)
for(j=0;j<strlen(name[i]);j++)
a[name[i][j]-'A']++;
max=a[0];
k=0;
for(i=0;i<26;i++)
if(a[i]>max){max=a[i];k=i;}
printf("%c\n%d\n",k+'A',a[k]);
for(i=0;i<n;i++)
for(j=0;j<strlen(name[i]);j++)
if(name[i][j]=='A'+k)
printf("%d\n",ID[i]);
}
| 2 |
527 |
struct book
{
int number;
char writer[26];
struct book *next;
}
main()
{
int n,i,j,num[26]={0},nu[26],a,b;
struct book *head,*p1,*p2;
scanf("%d",&n);
p1=p2=(struct book *)malloc(LEN);
for(i=0;i<n;i++)
{
scanf("%d%s",&p1->number,&p1->writer);
for(j=0;j<strlen(p1->writer);j++)
{
++num[p1->writer[j]-65];
}
if(i==0)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
}
p2->next=NULL;
for(i=0;i<26;i++)
{
nu[i]=i;
}
for(i=0;i<25;i++)
{
for(j=0;j<25-i;j++)
{
if(num[j]<num[j+1])
{
a=nu[j];
nu[j]=nu[j+1];
nu[j+1]=a;
b=num[j];
num[j]=num[j+1];
num[j+1]=b;
}
}
}
printf("%c\n%d\n",nu[0]+65,num[0]);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(head->writer);j++)
{
if(head->writer[j]==(char)nu[0]+65)
{
printf("%d\n",head->number);
break;
}
}
head=head->next;
}
} | 2 |
528 | struct a
{
int book;
char author[26];
struct a *next;
};
struct a *creat(int m)
{
int i=0;
struct a *p,*head,*temp;
head=NULL;
do
{
p=(struct a *)malloc(sizeof(struct a));
if(p==NULL){
exit(1);
}
scanf("%d %s",&p->book,p->author);
if(head==NULL){
head=p;
temp=p;}
else{
temp->next=p;
temp=p;
}
i++;
}while(i<m);
temp->next=NULL;
return(head);
}
void main()
{
int h,m,i,j,zimu[26]={0};
struct a *head,*p;
scanf("%d",&m);
head=creat(m);
p=head;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++){
if(p->author[j]>='A'&&p->author[j]<='Z')
{
zimu[p->author[j]-'A']++;
}
}
p=p->next;
}
h=0;
for(i=0;i<26;i++)
{
if(zimu[i]>zimu[h])
h=i;
}
printf("%c\n%d\n",'A'+h,zimu[h]);
p=head;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++){
if(p->author[j]=='A'+h)
{
printf("%d\n",p->book);
break;
}
}
p=p->next;
}
}
| 2 |
529 | struct library
{
int num;
char aut[30];
struct library *next;
}
main()
{
int m,i,j,a[30],t,b[30],x=0;
char name;
struct library *head;
struct library *p1,*p2,*p;
for(i=0;i<26;i++)
{
a[i]=0;
b[i]=0;
}
scanf("%d",&m);
p1=p2=(struct library*) malloc(LEN);
scanf("%d %s",&p1->num,p1->aut);
head=p1;
p2=p1;
for(i=0;i<m-1;i++)
{
p1=(struct library*) malloc(LEN);
scanf("%d %s",&p1->num,p1->aut);
p2->next=p1;
p2=p1;
}
p1->next=NULL;
p=head;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(p->aut[j]=='A') a[0]=a[0]+1;
if(p->aut[j]=='B') a[1]=a[1]+1;
if(p->aut[j]=='C') a[2]=a[2]+1;
if(p->aut[j]=='D') a[3]=a[3]+1;
if(p->aut[j]=='E') a[4]=a[4]+1;
if(p->aut[j]=='F') a[5]=a[5]+1;
if(p->aut[j]=='G') a[6]=a[6]+1;
if(p->aut[j]=='H') a[7]=a[7]+1;
if(p->aut[j]=='I') a[8]=a[8]+1;
if(p->aut[j]=='J') a[9]=a[9]+1;
if(p->aut[j]=='K') a[10]=a[10]+1;
if(p->aut[j]=='L') a[11]=a[11]+1;
if(p->aut[j]=='M') a[12]=a[12]+1;
if(p->aut[j]=='N') a[13]=a[13]+1;
if(p->aut[j]=='O') a[14]=a[14]+1;
if(p->aut[j]=='P') a[15]=a[15]+1;
if(p->aut[j]=='Q') a[16]=a[16]+1;
if(p->aut[j]=='R') a[17]=a[17]+1;
if(p->aut[j]=='S') a[18]=a[18]+1;
if(p->aut[j]=='T') a[19]=a[19]+1;
if(p->aut[j]=='U') a[20]=a[20]+1;
if(p->aut[j]=='V') a[21]=a[21]+1;
if(p->aut[j]=='W') a[22]=a[22]+1;
if(p->aut[j]=='X') a[23]=a[23]+1;
if(p->aut[j]=='Y') a[24]=a[24]+1;
if(p->aut[j]=='Z') a[25]=a[25]+1;
if(p->aut[j]=='\0') break;
}
p=p->next;
}
t=0;
for(i=1;i<26;i++)
{
if(a[t]<a[i]) t=i;
}
if(t==0)
{
printf("A\n");
name='A';
}
if(t==1)
{
printf("B\n");
name='B';
}
if(t==2)
{
printf("C\n");
name='C';
}
if(t==3)
{
printf("D\n");
name='D';
}
if(t==4)
{
printf("E\n");
name='E';
}
if(t==5)
{
printf("F\n");
name='F';
}
if(t==6)
{
printf("G\n");
name='G';
}
if(t==7)
{
printf("H\n");
name='H';
}
if(t==8)
{
printf("I\n");
name='I';
}
if(t==9)
{
printf("J\n");
name='J';
}
if(t==10)
{
printf("K\n");
name='K';
}
if(t==11)
{
printf("L\n");
name='L';
}
if(t==12)
{
printf("M\n");
name='M';
}
if(t==13)
{
printf("N\n");
name='N';
}
if(t==14)
{
printf("O\n");
name='O';
}
if(t==15)
{
printf("P\n");
name='P';
}
if(t==16)
{
printf("Q\n");
name='Q';
}
if(t==17)
{
printf("R\n");
name='R';
}
if(t==18)
{
printf("S\n");
name='S';
}
if(t==19)
{
printf("T\n");
name='T';
}
if(t==20)
{
printf("U\n");
name='U';
}
if(t==21)
{
printf("V\n");
name='V';
}
if(t==22)
{
printf("W\n");
name='W';
}
if(t==23)
{
printf("X\n");
name='X';
}
if(t==24)
{
printf("Y\n");
name='Y';
}
if(t==25)
{
printf("Z\n");
name='Z';
}
printf("%d\n",a[t]);
p=head;
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(p->aut[j]==name)
{
b[x]=p->num;
x=x+1;
break;
}
}
p=p->next;
}
for(i=0;i<x-1;i++) printf("%d\n",b[i]);
printf("%d",b[i]);
}
| 2 |
530 |
void main()
{
int j,n,i,book,max=0,pos,a[30][1000]={0};
char s[100];
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d%s",&book,&s);
for (j=0;j<strlen(s);j++)
{
a[s[j]-'A'][0]++;
a[s[j]-'A'][a[s[j]-'A'][0]]=book;
}
}
for (i=0;i<26;i++)
if (a[i][0]>max)
{
max=a[i][0];
pos=i;
}
printf("%c\n%d\n",pos+'A',a[pos][0]);
for (i=1;i<=a[pos][0];i++)
printf("%d\n",a[pos][i]);
} | 2 |
531 | 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 |
532 | struct shu
{
int bianhao;
char name[26];
}shu[999];
int main ()
{
int m;
scanf("%d",&m);
int i,j,k;
int jishu[26]={0};
int beiyong[26];
for (i=0;i<m;i++)
scanf("%d %s",&shu[i].bianhao,shu[i].name);
for (i=0;i<26;i++)
{
for (j=0;j<m;j++)
{
for (k=0;k<26;k++)
{
if (shu[j].name[k]==i+'A')
jishu[i]++;
}
}
}
for (i=0;i<26;i++)
beiyong[i]=jishu[i];
int max=0;
for (i=0;i<26;i++)
{
if (beiyong[i]>max)
max=beiyong[i];
}
int t;
for (i=0;i<26;i++)
{
if (jishu[i]==max)
t=i;
}
printf("%c\n",t+'A');
printf("%d\n",max);
for (i=0;i<m;i++)
{
for (j=0;j<26;j++)
{
if (shu[i].name[j]==t+'A')
printf("%d\n",shu[i].bianhao);
}
}
} | 2 |
533 | struct book
{
int id;
char zz[26];
} b[999];
int main()
{
int m,n,i,num[26]={0},maxz,j;
char string[26];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&b[i].id,&b[i].zz);
for(j=0;b[i].zz[j]!='\0';j++)
num[b[i].zz[j]-'A']++;
}
int max=0;
for(i=0;i<26;i++)
if(max<num[i]) { max=num[i]; maxz=i;}
printf("%c\n%d",maxz+65,max);
for(i=0;i<m;i++)
for(j=0;b[i].zz[j]!='\0';j++)
{if(b[i].zz[j]==maxz+65) printf("\n%d", b[i].id);
else continue;}
}
| 2 |
534 |
struct book
{
int id;
char author[27];
struct book *next;
};
struct book *creat()
{
int n , i;
scanf("%d",&n);
struct book *p1,*head,*p0;
head = NULL;
p1 = head;
for ( i = 0 ; i < n ; i ++)
{
p0 = (struct book *)malloc(sizeof(struct book));
scanf("%d %s" , &p0->id , p0->author );
if( head == NULL )
{
p1 = p0;
head = p1;
p0->next = NULL;
}
else
{
p1->next = p0;
p0->next = NULL;
p1 = p0;
}
}
return (head);
}
char best(struct book *head)
{
int i , max , a[26] ;
struct book *p;
p = head;
for (i = 0;i < 26;++i) a[i] = 0;
while(p != NULL)
{
i = 0;
while( p->author[i] != '\0')
{
a[p->author[i]-'A']++;
i ++;
}
p = p->next;
}
for(i = 0 ; i < 26 ; i ++ )
{
if ( i == 0 ) max = i;
else if ( a[i] > a[max]) max = i;
}
return ('A'+max);
}
void print(char x , struct book *head )
{
int i,k = 0;
char a = x;
struct book *p = head;
while(p != NULL)
{
i = 0 ;
while ( p->author[i] != '\0' )
{
if(p->author[i] == a)
{
k ++;
break;
}
i ++;
}
p = p->next;
}
printf("%c\n%d\n" , a , k);
p = head;
while(p != NULL)
{
i = 0;
while ( p->author[i] != '\0' )
{
if(p->author[i] == a)
{
printf("%d\n",p->id);
break;
}
i ++;
}
p = p->next;
}
}
int main(int argc, char* argv[])
{
char writer;
struct book *head;
head = creat();
writer = best(head);
print(writer,head);
return 0;
}
| 2 |
535 | void main()
{
int n,i;
scanf("%d",&n);
int b[1000];
char s[1000][26];
for(i=0;i<n;i++)
{
scanf("%d%s",&b[i],&s[i]);
}
int a[26]={0};
char c[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(i=0;i<n;i++)
{
int l,j;
l=strlen(s[i]);
for(j=0;j<l;j++)
{
switch(s[i][j])
{
case'A':a[0]=a[0]+1;break;
case'B':a[1]=a[1]+1;break;
case'C':a[2]=a[2]+1;break;
case'D':a[3]=a[3]+1;break;
case'E':a[4]=a[4]+1;break;
case'F':a[5]=a[5]+1;break;
case'G':a[6]=a[6]+1;break;
case'H':a[7]=a[7]+1;break;
case'I':a[8]=a[8]+1;break;
case'J':a[9]=a[9]+1;break;
case'K':a[10]=a[10]+1;break;
case'L':a[11]=a[11]+1;break;
case'M':a[12]=a[12]+1;break;
case'N':a[13]=a[13]+1;break;
case'O':a[14]=a[14]+1;break;
case'P':a[15]=a[15]+1;break;
case'Q':a[16]=a[16]+1;break;
case'R':a[17]=a[17]+1;break;
case'S':a[18]=a[18]+1;break;
case'T':a[19]=a[19]+1;break;
case'U':a[20]=a[20]+1;break;
case'V':a[21]=a[21]+1;break;
case'W':a[22]=a[22]+1;break;
case'X':a[23]=a[23]+1;break;
case'Y':a[24]=a[24]+1;break;
default:a[25]=a[25]+1;
}
}
}
int m;
char z;
m=a[0],z=c[0];
for(i=1;i<26;i++)
{
if(a[i]>m)
m=a[i],z=c[i];
}
printf("%c\n%d\n",z,m);
for(i=0;i<n;i++)
{
int l,j;
l=strlen(s[i]);
for(j=0;j<l;j++)
{
if(s[i][j]==z)
{
printf("%d\n",b[i]);
break;
}
}
}
} | 2 |
536 | int main()
{
int m ;
cin >> m ;
int p ;
char a[m+1][27];
int len[m +1];
int b[m+1];
int c[26];
int i , j , k ,l ;
for( i = 0 ;i <=25 ; i++ )
c[i] = 0 ;
for( i = 1 ; i <= m ; i ++ )
{
cin >> b[i];
cin >> a[i] ;
len[i] = strlen(a[i]);
for( j = 0; j <= len[i] -1 ; j ++ )
{
c[a[i][j] - 'A']++ ;
}
}
int temp = -1 ;
for( i = 0; i<= 25 ; i ++ )
{
if( c[i]> temp )
{
temp = c[i] ;
p = i ;
}
}
char n = 'A'+ p ;
cout << n << endl ;
cout << temp << endl ;
for( i = 1; i <= m ; i ++ )
for ( j = 0 ; j<= len[i] -1 ; j ++ )
{
if(a[i][j] == '\0')
{
break ;
}
else if(a[i][j] == n)
{
cout << b[i]<<endl;
break ;
}
}
return 0 ;
} | 2 |
537 |
int main()
{
int n;
scanf("%d",&n);
struct book{
int booknumber;
char writer[27];
}book[999];
int i;
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i].booknumber,book[i].writer);
}
int writerbookquantity[26];
for(i=0;i<26;i++)writerbookquantity[i]=0;
int j,len,x;
for(i=0;i<n;i++)
{
len=strlen(book[i].writer);
for(j=0;j<len;j++)
{
x= book[i].writer[j]-'A';
writerbookquantity[x]++;
}
}
int maxwriter=0,maxquantity=0;
for(i=0;i<26;i++)
{
if(writerbookquantity[i]>maxquantity)
{
maxquantity=writerbookquantity[i];
maxwriter=i;
}
}
printf("%c\n%d\n",(char)(maxwriter+'A'),writerbookquantity[maxwriter]);
for(i=0;i<n;i++)
{
len=strlen(book[i].writer);
for(j=0;j<len;j++)
{
if((int)book[i].writer[j]==maxwriter+'A')
printf("%d\n",book[i].booknumber);
}
}
return 0;
}
| 2 |
538 | void main()
{
int n,i,j,k=0,name[26]={0},max,a[1000],t=0;
char word[1000][30];
scanf("%d",&n);
for(i=-1;i<n;i++)
{
gets(word[i]);
}
for(j=0;j<26;j++)
{
for(i=0;i<n;i++)
{
while(word[i][k]!='\0')
{
if(word[i][k]=='A'+j)
{
name[j]=name[j]+1;
}
k=k+1;
}
k=0;
}
}
k=0;
max=name[0];
j=0;
for(i=1;i<26;i++)
{
if(name[i]>max)
{
max=name[i];
j=i;}
}
for(i=0;i<n;i++)
{
while(word[i][k]!='\0')
{
if(word[i][k]=='A'+j)
{
a[t]=i;
t=t+1;
k=0;
break;
}
k=k+1;
}
k=0;
}
printf("%c\n%d\n",'A'+j,max);
k=0;
for(i=0;i<t;i++)
{
while(word[a[i]][k]!=' ')
{
printf("%c",word[a[i]][k]);
k=k+1;
}
printf("\n");
k=0;
}
} | 2 |
539 |
struct book
{
int num;
char au[30];
struct book *next;
};
void main()
{
int m;
scanf("%d",&m);
struct book *p1,*p2,*head;
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->num,p1->au);
p2=p1;
head=p1;
int n=1;
while(n<m)
{
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->num,p1->au);
p2->next=p1;
p2=p1;
n++;
}
p2->next=NULL;
char maxa;
char author;
char temp[30];
int an,maxn=0,i;
struct book *p;
for(author='A';author<='Z';)
{
p=head;
an=0;
while(p)
{
strcpy(temp,p->au);
for(i=0;(temp[i])!='\0';i++)
{
if(temp[i]==author){an++;break;}
}
p=p->next;
}
if(an>maxn)
{
maxa=author;
maxn=an;
}
author=author+1;
}
printf("%c\n%d",maxa,maxn);
p=head;
while(p)
{
strcpy(temp,p->au);
for(i=0;(temp[i])!='\0';i++)
{
if(temp[i]==maxa)
{ printf("\n");
printf("%d",p->num);break;}
}
p=p->next;
}
}
| 2 |
540 | /*
* most books.cpp
* ??:?????????
* Created on: 2012-12-30
* Author: ???
*/
int main()
{
int m=0,num=0,wnum=0,max=0,i=0,j=0; //??????,??,????,?????
int books[26][30]; //??26??????????
char writer[26],name; //????????
memset(books,0,sizeof(books)); //???
cin>>m;
for(i=0;i<m;i++) //???????????
{
cin>>num>>writer;
wnum=strlen(writer);
for(j=0;j<wnum;j++) //??????????,?????
{
books[writer[j]-65][0]++;
books[writer[j]-65][books[writer[j]-65][0]]=num;
}
}
for(j=0;j<26;j++) //??
if(max<books[j][0])
{
max=books[j][0];
name=j+65;
}
cout<<name<<endl;
cout<<max<<endl;
for(j=1;j<=max;j++)
cout<<books[name-65][j]<<endl;
return 0;
} | 2 |
541 |
struct Books
{
int num;
char author[26];
}a[1000];
int main()
{
int n;
int i,j;
int x;
int max=0;
char letter='A';
int b[26]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i].num,a[i].author);
}//??a[];
for(i=0;i<n;i++)
{
for(j=0;;j++)
{
if(a[i].author[j]>=65 && a[i].author[j]<=90)
{
x=a[i].author[j];//x:65-90
b[x-65]++;
}else{
break;
}
}
}//?????
// for(i=0;i<26;i++)
// {
// printf("%d\n",b[i]);
// }
for(i=0;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
letter=i+65;
}
}
printf("%c\n%d\n",letter,max);
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(a[i].author[j]==letter)
{
printf("%d\n",a[i].num);
}
}
}
return 0;
} | 2 |
542 | struct inf
{
int num;
char name[26];
struct inf *next;
};
int m;
struct inf *creat(void)
{
struct inf *head,*p1,*p2;
int n;
p1=p2=(struct inf *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
n=0;
while(1)
{
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
if(n==m)
break;
else
{
p1=(struct inf *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
}
}
p2->next=NULL;
return(head);
}
void count(struct inf *head,int o)
{
struct inf *q1;
int *q2,*q3,*q4;
char *t1;
q1=head;
q2=(int *)malloc(26*LEM);
for(q3=q2;q3<q2+26;q3++)
*q3=0;
while(q1!=NULL)
{
for(t1=q1->name;*t1!='\0';t1++)
*(q2+(*t1-'A'))=*(q2+(*t1-'A'))+1;
q1=q1->next;
}
q4=q2;
for(q3=q2;q3<q2+26;q3++)
if(*q4<*q3)
q4=q3;
printf("%c\n%d\n",q4-q2+'A',*q4);
q1=head;
while(q1!=NULL)
{
for(t1=q1->name;*t1!='\0';t1++)
if(*t1==(q4-q2+'A'))
printf("%d\n",q1->num);
q1=q1->next;
}
}
void main()
{
struct inf *head,*s;
scanf("%d",&m);
head=creat();
s=head;
count(head,m);
/* while(s!=NULL)
{
printf("%d %s\n",s->num,s->name);
s=s->next;
}*/
}
| 2 |
543 | int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;
int max = 0;
char maxn;
struct book
{
int id;
char author[28];
}*bb;
void find ( int ii );
int main()
{
int n;
scanf("%d",&n);
int ii;
bb = ( struct book * ) malloc ( sizeof ( struct book ) * n );
for ( ii = 0; ii < n ; ii++ )
{
scanf("%d %s",&bb[ii].id,bb[ii].author);
}
for ( ii = 0 ; ii < n ; ii++ )
{
find (ii);
}
printf("%c\n",maxn);
printf("%d\n",max);
int jj;
for ( ii = 0 ; ii < n ; ii++ )
{
for ( jj = 0 ; bb[ii].author[jj] != '\0' ; jj++)
{
if ( bb[ii].author[jj] == maxn )
{
printf("%d\n",bb[ii].id);
}
}
}
free(bb);
return 0;
}
void find ( int ii )
{
int aa = 0;
for ( aa = 0 ; bb[ii].author[aa] != '\0' ; aa++ )
{
switch(bb[ii].author[aa])
{
case 'A':{a++;if ( a > max ) max = a,maxn = 'A' ; break;}
case 'B':{b++;if ( b > max ) max = b,maxn = 'B' ; break;}
case 'C':{c++;if ( c > max ) max = c,maxn = 'C' ; break;}
case 'D':{d++;if ( d > max ) max = d,maxn = 'D' ; break;}
case 'E':{e++;if ( e > max ) max = e,maxn = 'E' ; break;}
case 'F':{f++;if ( f > max ) max = f,maxn = 'F' ; break;}
case 'G':{g++;if ( g > max ) max = g,maxn = 'G' ; break;}
case 'H':{h++;if ( h > max ) max = h,maxn = 'H' ; break;}
case 'I':{i++;if ( i > max ) max = i,maxn = 'I' ; break;}
case 'J':{j++;if ( j > max ) max = j,maxn = 'J' ; break;}
case 'K':{k++;if ( k > max ) max = k,maxn = 'K' ; break;}
case 'L':{l++;if ( l > max ) max = l,maxn = 'L' ; break;}
case 'M':{m++;if ( m > max ) max = m,maxn = 'M' ; break;}
case 'N':{n++;if ( n > max ) max = n,maxn = 'N' ; break;}
case 'O':{o++;if ( o > max ) max = o,maxn = 'O' ; break;}
case 'P':{p++;if ( p > max ) max = p,maxn = 'P' ; break;}
case 'Q':{q++;if ( q > max ) max = q,maxn = 'Q' ; break;}
case 'R':{r++;if ( r > max ) max = r,maxn = 'R' ; break;}
case 'S':{s++;if ( s > max ) max = s,maxn = 'S' ; break;}
case 'T':{t++;if ( t > max ) max = t,maxn = 'T' ; break;}
case 'U':{u++;if ( u > max ) max = u,maxn = 'U' ; break;}
case 'V':{v++;if ( v > max ) max = v,maxn = 'V' ; break;}
case 'W':{w++;if ( w > max ) max = w,maxn = 'W' ; break;}
case 'X':{x++;if ( x > max ) max = x,maxn = 'X' ; break;}
case 'Y':{y++;if ( y > max ) max = y,maxn = 'Y' ; break;}
case 'Z':{z++;if ( z > max ) max = z,maxn = 'Z' ; break;}
}
}
}
| 2 |
544 | int main()
{
struct bookinf
{
int code;
char auth[27];
}book[999];
int i,k,m,max=0,num[26];
for (i=0;i<26;i++)
num[i]=0;
scanf("%d", &m);
for (i=0;i<m;i++)
{
scanf ("%d %s", &book[i].code, book[i].auth);
for (k=0;book[i].auth[k]!='\0';k++)
num[book[i].auth[k]-'A']+=1;
}
for (i=1;i<26;i++)
{
if (num[i]>num[max])
max=i;
}
printf("%c\n%d\n", max+'A', num[max]);
for (i=0;i<m;i++)
{
for (k=0;book[i].auth[k]!='\0';k++)
{
if (book[i].auth[k]==max+'A')
{
printf("%d\n", book[i].code);
break;
}
}
}
return 0;
}
| 2 |
545 | struct lib
{
int num;
char author[26];
}book[1000];
int main()
{
int n,i,k,p,e;
e=0;
int tol[1000]={0};
int own[1000][1000];
scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d%s",&(book[i].num),book[i].author);
}
for(k='A';k<='Z';k++){
for(i=0;i<=n-1;i++){
for(p=0;p<=25;p++){
if(k==book[i].author[p]){
tol[k]++;
own[k][i]=book[i].num;
}
}
}
}
for(i='A';i<='Z';i++){
if(tol[i]>e){
e=tol[i];
}
}
for(k='A';k<='Z';k++){
if(tol[k]==e){
printf("%c\n%d\n",k,tol[k]);
for(p=0;p<=n-1;p++){
if(own[k][p]!=0){
printf("%d\n",own[k][p]);
}
}
break;
}
}
return 0;
} | 2 |
546 | int main()
{
int n,i,j,k,w=0;
int maxzm,maxbk=0;
char c1;
int zimu[26]={0};
int lm[100];
struct{
int num;
char a[100];
}book[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&book[i].num,book[i].a);
for(i=0;i<n;i++)
{
for(j=0;book[i].a[j];j++)
{
for(k=65;k<91;k++)
{
if(book[i].a[j]==k)
zimu[k-65]++;
}
}
}
for(i=0;i<26;i++)
{
if(zimu[i]>maxbk)
{
maxbk=zimu[i];
maxzm=i;
}
}
c1=maxzm+65;
printf("%c\n",c1);
printf("%d\n",maxbk);
for(i=0;i<n;i++)
{
for(j=0;book[i].a[j];j++)
{
if(book[i].a[j]==c1)
{
lm[w]=book[i].num;
w++;
continue;
}
}
}
for(i=0;i<w;i++)
printf("%d\n",lm[i]);
return 0;
} | 2 |
547 |
struct book{
int num;
char writer[27];
};
void main()
{
struct book *p,*head;
int n,i,j,max,maxi;
int l[26]={0},lnum[999];
void count(int *l,struct book *p,int lnum);
int read(struct book *p);
scanf("%d",&n);
head=p=(struct book *)calloc(n,sizeof(struct book));
for(i=0;i<n;i++,p++)
{
lnum[i]=read(p);
}
p=head;
for(i=0;i<n;i++)
{
count(l,p,lnum[i]);
p++;
}
max=l[0]; maxi=0;
for(i=1;i<26;i++)
{
if(max<l[i])
{
max=l[i];
maxi=i;
}
}
printf("%c\n",65+maxi);
printf("%d\n",max);
p=head;
for(i=0;i<n;i++)
{
for(j=0;j<lnum[i];j++)
{
if(p->writer[j]==65+maxi)
{
printf("%d\n",p->num);
break;
}
}
p++;
}
}
int read(struct book *p)
{
int i=0;
char d;
scanf("%d",&p->num);
d=getchar();
d=getchar();
do{
p->writer[i]=d;
i++;
}while((d=getchar())!='\n');
return(i);
}
void count(int *l,struct book *p,int lnum)
{
int i;
for(i=0;i<lnum;i++)
{
switch(p->writer[i])
{
case'A':l[0]++; break; case'B':l[1]++; break;
case'C':l[2]++; break; case'D':l[3]++; break;
case'E':l[4]++; break; case'F':l[5]++; break;
case'G':l[6]++; break; case'H':l[7]++; break;
case'I':l[8]++; break; case'J':l[9]++; break;
case'K':l[10]++; break; case'L':l[11]++; break;
case'M':l[12]++; break; case'N':l[13]++; break;
case'O':l[14]++; break; case'P':l[15]++; break;
case'Q':l[16]++; break; case'R':l[17]++; break;
case'S':l[18]++; break; case'T':l[19]++; break;
case'U':l[20]++; break; case'V':l[21]++; break;
case'W':l[22]++; break; case'X':l[23]++; break;
case'Y':l[24]++; break; case'Z':l[25]++; break;
}
}
} | 2 |
548 | 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 |
549 | struct book
{
int num;
char ren[26];
}
main()
{
struct book shu[999];
int m,i,j,k,max=0,p;
int a[26]={0};
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&shu[i].num,shu[i].ren);
for(j=0;shu[i].ren[j]!='\0';j++)
for(k=65;k<91;k++)
if(shu[i].ren[j]==k)
a[k-65]++;
}
for(i=0;i<26;i++)
if(max<a[i])
max=a[i];
for(i=0;i<26;i++)
if(max==a[i])
{
p=i+65;
printf("%c\n%d\n",p,a[p-65]);
}
for(i=0;i<m;i++)
for(j=0;shu[i].ren[j]!='\0';j++)
if(p==shu[i].ren[j])
printf("%d\n",shu[i].num);
} | 2 |
550 | 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 |
551 | 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 |
552 | 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 |
553 | struct book
{
int code;
char writer[10];
};
void main()
{
int n,i,j,t=0,d,ww[27]={0};
char max,w[27];
struct book list[999];
scanf("%d",&n);
for(i=0;i<26;i++)w[i]=i+65;
for(i=0;i<n;i++)
scanf("%d %s",&list[i].code,list[i].writer);
for(i=0;i<n;i++)
for(j=0;list[i].writer[j]!='\0';j++)
{
for(d=0;d<26;d++)
if(list[i].writer[j]==w[d])ww[d]++;
}
max=ww[0];
for(i=0;i<26;i++)
if(ww[i]>max)
{
max=ww[i];
t=i;
}
printf("%c\n%d\n",w[t],ww[t]);
for(i=0;i<n;i++)
for(j=0;list[i].writer[j]!='\0';j++)
{
if(list[i].writer[j]==w[t])printf("%d\n",list[i].code);
}
} | 2 |
554 | int main()
{
int num,i,j;
char a='A';
int count[27]={0};
int *p=&count[1];
scanf("%d",&num);
struct book
{
char order[4];
char author[26];
}book[1000];
for(i=0;i<num;i++)
{
scanf("%s",book[i].order);
scanf("%s",book[i].author);
}
for(i=0;i<num;i++)
{
int m=strlen(book[i].author);
for(j=0;j<m;j++)
{
if(book[i].author[j]=='A')count[1]++;
if(book[i].author[j]=='B')count[2]++;
if(book[i].author[j]=='C')count[3]++;
if(book[i].author[j]=='D')count[4]++;
if(book[i].author[j]=='E')count[5]++;
if(book[i].author[j]=='F')count[6]++;
if(book[i].author[j]=='G')count[7]++;
if(book[i].author[j]=='H')count[8]++;
if(book[i].author[j]=='I')count[9]++;
if(book[i].author[j]=='J')count[10]++;
if(book[i].author[j]=='K')count[11]++;
if(book[i].author[j]=='L')count[12]++;
if(book[i].author[j]=='M')count[13]++;
if(book[i].author[j]=='N')count[14]++;
if(book[i].author[j]=='O')count[15]++;
if(book[i].author[j]=='P')count[16]++;
if(book[i].author[j]=='Q')count[17]++;
if(book[i].author[j]=='R')count[18]++;
if(book[i].author[j]=='S')count[19]++;
if(book[i].author[j]=='T')count[20]++;
if(book[i].author[j]=='U')count[21]++;
if(book[i].author[j]=='V')count[22]++;
if(book[i].author[j]=='W')count[23]++;
if(book[i].author[j]=='X')count[24]++;
if(book[i].author[j]=='Y')count[25]++;
if(book[i].author[j]=='Z')count[26]++;
}
}
for(i=1;i<27;i++)
{
if(count[i]>*p)
{
p=&count[i];
a=i+64;
}
}
printf("%c\n%d\n",a,*p);
for(i=0;i<num;i++)
{
for(j=0;j<strlen(book[i].author);j++)
{
if(book[i].author[j]==a)
printf("%s\n",book[i].order);
}
}
return 0;
}
| 2 |
555 |
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 |
556 | void main()
{
char a[1000][100];
int b[1000],c[27],s[1000],max,i,j,k;
int n;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %s",&b[i],a[i]);
s[i]=strlen(a[i]);
}
for (j=0;j<26;j++)
{
c[j]=0;
for (i=0;i<n;i++)
{
for (k=0;k<s[i];k++)
{
if (a[i][k]==65+j)
c[j]=c[j]+1;
}
}
}
max=0;
for (i=0;i<26;i++)
{
if (c[i]>max)
max=c[i];
}
for (i=0;i<26;i++)
{
if (c[i]==max)
{
printf("%c\n",i+65);
printf("%d\n",c[i]);
for (k=0;k<n;k++)
{
for (j=0;j<s[k];j++)
{
if (a[k][j]==65+i)
printf("%d\n",b[k]);
}
}
}
}
} | 2 |
557 | 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 |
558 | int main()
{
int n,i,j,num[1000],l[1000],count[128],m,max;
char edi[1000][26],au[128];
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("\n%d",&num[j]);
gets(edi[j]);
l[j]=strlen(edi[j]);
}
for(i=0;i<128;i++)
count[i]=0;
for(j=0;j<n;j++)
{
for(i=1;i<l[j];i++)
{
m=edi[j][i];
au[m]=edi[j][i];
count[m]++;
}
}
max=0;
for(i=0;i<128;i++)
{
if(count[i]>max)
{
max=count[i];
m=i;
}
}
printf("%c\n%d",au[m],max);
for(j=0;j<n;j++)
{
for(i=1;i<l[j];i++)
{
if(edi[j][i]==au[m])
printf("\n%d",num[j]);
}
}
return 0;
}
| 2 |
559 |
struct stu{
int num;
char id[26];
}a[999];
struct aut{
char wri;
int sum;
}b[26];
int main(){
int n,i,j,k,t,m=0;
for(i=0;i<26;i++){
b[i].wri='A'+i;
b[i].sum=0;
}
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i].num);
scanf("%s",a[i].id);
}
for(j=0;j<26;j++){
for(i=0;i<n;i++){
for(k=0;k<26;k++){
if(b[j].wri==a[i].id[k]){
b[j].sum++;
}
}
}
}
int max=b[0].sum;
for(j=0;j<26;j++){
if(max<b[j].sum){
max=b[j].sum;
m=j;
}
}
printf("%c\n%d\n",b[m].wri,max);
for(i=0;i<n;i++){
for(k=0;k<26;k++){
if(a[i].id[k]==b[m].wri)
printf("%d\n",a[i].num);
}
}
return 0;
} | 2 |
560 | void main()
{
int n,i,j,max=0;
scanf("%d",&n);
int num[1000];
int sum[26];
for(i=0;i<26;i++){
sum[i]=0;
}
char a[1000][27];
for(i=0;i<n;i++){
scanf("%d %s",&num[i],a[i]);
}
for(i=0;i<n;i++){
for(j=0;a[i][j]!='\0';j++){
sum[a[i][j]-'A']=sum[a[i][j]-'A']+1;
}
}
for(i=1;i<26;i++){
if(sum[i]>sum[max]){
max=i;
}
}
printf("%c\n",max+'A');
printf("%d\n",sum[max]);
for(i=0;i<n;i++){
for(j=0;a[i][j]!='\0';j++){
if(a[i][j]==max+'A'){
printf("%d\n",num[i]);
break;
}
}
}
}
| 2 |
561 |
int main()
{
struct {
int num;
char author[26];
}book[1000];
int shu_num[26],i,j,k,n,max,length;
char max_author;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&book[i].num,book[i].author);
}
for(k=0;k<26;k++){
shu_num[k]=0;
}
for(k=0;k<26;k++){
for(i=0;i<n;i++){
length=strlen(book[i].author);
for(j=0;j<length;j++){
if(book[i].author[j]=='A'+k){
shu_num[k]++;
}
}
}
}
max=shu_num[0];
max_author='A';
for(k=0;k<26;k++){
if(shu_num[k]>max){
max=shu_num[k];
max_author='A'+k;
}
}
printf("%c\n%d\n",max_author,max);
for(i=0;i<n;i++){
length=strlen(book[i].author);
for(j=0;j<length;j++){
if(book[i].author[j]==max_author){
printf("%d\n",book[i].num);
}
}
}
return 0;
} | 2 |
562 |
struct book{
int num;
char author[26];}shu[999];
int main(int argc, char* argv[])
{
int m,b,i,*p;
char c;
int writer[26];
char max(int *p);
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d%s",&shu[i].num,shu[i].author);}
for(c='A',writer[c-'A']=0;c<='Z';c++){
writer[c-'A']=0;
for(i=0;i<m;i++){
for(b=0;shu[i].author[b]!='\0';b++){
if(c==shu[i].author[b]){
writer[c-'A']++;}}}}
p=writer;
printf("%c\n%d\n",max(p),writer[max(p)-'A']);
for(i=0;i<m;i++){
for(b=0;shu[i].author[b]!='\0';b++){
if(max(p)==shu[i].author[b]){
printf("%d\n",shu[i].num);}}}
return 0;
}
char max(int *p){
int i;
char max;
for(i=0,max='A';i<26;i++){
if(*(p+i)>*(p+max-'A')){
max=i+'A';}}
return max;}
| 2 |
563 | struct info
{
short int num;
char author[27];
};
int main()
{
char findoutmax(struct info a[],int n,int *pt);
void detect(struct info b[],char writter,int nn);
char figure;
int i,n_book,max,*p;
struct info book[999];
scanf("%d",&n_book);
for (i=0;i<n_book;i++)
{
scanf("%d %s",&book[i].num , &book[i].author);
}
p=&max;
figure=findoutmax(book,n_book,p);
printf("%c\n%d\n",figure,max);
detect(book,figure,n_book);
return 0;
}
char findoutmax(struct info a[],int n,int *pt)
{
int i,j,sum[26]={0};
for (i=0;i<n;i++)
{
for (j=0;a[i].author[j]!='\0';j++)
{
switch (a[i].author[j])
{
case 'A': sum[0]=sum[0]+1; break;
case 'B': sum[1]=sum[1]+1; break;
case 'C': sum[2]=sum[2]+1; break;
case 'D': sum[3]=sum[3]+1; break;
case 'E': sum[4]=sum[4]+1; break;
case 'F': sum[5]=sum[5]+1; break;
case 'G': sum[6]=sum[6]+1; break;
case 'H': sum[7]=sum[7]+1; break;
case 'I': sum[8]=sum[8]+1; break;
case 'J': sum[9]=sum[9]+1; break;
case 'K': sum[10]=sum[10]+1; break;
case 'L': sum[11]=sum[11]+1; break;
case 'M': sum[12]=sum[12]+1; break;
case 'N': sum[13]=sum[13]+1; break;
case 'O': sum[14]=sum[14]+1; break;
case 'P': sum[15]=sum[15]+1; break;
case 'Q': sum[16]=sum[16]+1; break;
case 'R': sum[17]=sum[17]+1; break;
case 'S': sum[18]=sum[18]+1; break;
case 'T': sum[19]=sum[19]+1; break;
case 'U': sum[20]=sum[20]+1; break;
case 'V': sum[21]=sum[21]+1; break;
case 'W': sum[22]=sum[22]+1; break;
case 'X': sum[23]=sum[23]+1; break;
case 'Y': sum[24]=sum[24]+1; break;
case 'Z': sum[25]=sum[25]+1; break;
}
}
}
j=0;
for (i=1;i<26;i++)
{
if (sum[j]<sum[i]) j=i;
}
*pt=sum[j];
return (65+j);
}
void detect(struct info b[],char writter,int nn)
{
int i,j;
for (i=0;i<nn;i++)
{
for (j=0;b[i].author[j]!='\0';j++)
{
if (b[i].author[j]==writter)
{
printf("%d\n",b[i].num);
}
}
}
}
| 2 |
564 |
int main()
{
int n ;
cin >> n ;
int shu ;
char ppl[27] ;
int a[26][n+1] ;
memset( a , 0 , sizeof( a ) ) ;//???
for( int i = 0 ; i < n ; i ++ )
{
memset( ppl , 0 , sizeof( ppl ) ) ;//????
cin >> shu ;//????
getchar() ;//???
cin.getline( ppl , 27 ,'\n' ) ;//????
for( int j = 0 ; 'A' <= ppl[j] && ppl[j] <= 'Z' ; j ++ )
{
a[ (int) ppl[j] - ( int ) 'A' ][0] ++ ;//0????
a[ (int) ppl[j] - ( int ) 'A' ][ a[ (int) ppl[j] - ( int ) 'A' ][0] ] = shu ;//??????
}
}
int max = 0 , set = 0 ;//??????
for( int i = 0 ; i < 26 ; i ++ )
{
if( a[i][0] > max )
{
max = a[i][0] ;
set = i ;
}
}
cout << ( char ) ( ( int )'A' + set ) << endl ;//???????
cout << max << endl ;
for( int i = 1 ; i <= max ; i ++ )
cout << a[set][i] << endl ;
return 0 ;
} | 2 |
565 | 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 |
566 | int main()
{
int n,i,j,k,max;
char name[2000][30],alp[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
int No[2000],num[30]={0};
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&No[i],name[i]);
}
for(i=0;i<26;i++){
for(k=0;k<n;k++){
for(j=0;j<strlen(name[k]);j++){
if(name[k][j]==alp[i]){
num[i]++;
break;
}
}
}
}
max=num[0];
for(i=1;i<26;i++){
if(num[i]>max){
max=num[i];
}
}
for(i=0;i<26;i++){
if(num[i]==max){
printf("%c\n%d\n",alp[i],max);
for(k=0;k<n;k++){
for(j=0;j<27;j++){
if(name[k][j]==alp[i]){
printf("%d\n",No[k]);
break;
}
}
}
}
}
return 0;
}
| 2 |
567 | int main()
{
struct x
{int num;
char name[26];
}book[1000];
int i,j,m,n,k,ex;
int a[26][1000];
int count[26]={0},num[26]={65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90};
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&book[i].num);
gets(book[i].name);
}
for(i='A';i<='Z';i++)
{
for(j=0;j<m;j++)
{
n=strlen(book[j].name);
for(k=0;k<n;k++)
{
if(i==book[j].name[k])
count[i-65]++;
}
}
}
for(i=0;i<25;i++)
{
if(count[i]>count[i+1])
{
ex=count[i];
count[i]=count[i+1];
count[i+1]=ex;
ex=num[i];
num[i]=num[i+1];
num[i+1]=ex;
}
}
printf("%c\n%d\n",num[25],count[25]);
for(i=0;i<m;i++)
{
n=strlen(book[i].name);
for(k=0;k<n;k++)
{
if(book[i].name[k]==num[25])
printf("%d\n",book[i].num);
}
}
return 0;
}
| 2 |
568 | int n;
struct student
{
char name[100];
int num;
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int i;
p1=p2=(struct student*)malloc(LEN);
head=p1;
for(i=0;i<n;i++)
{p1=(struct student*)malloc(LEN);
p2->next=p1;
p2=p1;
scanf("%d %s",&p1->num,p1->name);
}
p2->next=NULL;
return(head);
}
void list(struct student *head)
{
struct student *p1,*p2,*p3,*p4;
int i,j,t,a[100]={0},b[100];
char str[100];
p1=head->next;
for(i=0;i<n;i++)
{
strcpy(str,p1->name);
for(j=0;j<strlen(str);j++) //?????2?????i????
{if(str[j]>='A'&&str[j]<='Z'){a[str[j]-65]++;} //?????????a[]????
}
p1=p1->next;
}
for(i=0;i<26;i++){b[i]=a[i];}
for(i=0;i<26-1;i++)
{for(j=0;j<26-1-i;j++)
{if(a[j]<a[j+1]){t=a[j];a[j]=a[j+1];a[j+1]=t;} //????
}
}
for(i=0;i<26;i++)
{if(b[i]==a[0]) {printf("%c\n%d\n",i+65,a[0]);t=i;} //b[i]?=a[0]????????,??????
}
p1=head->next; //??8??????????????????????????????????????????????
for(i=0;i<n;i++)
{
strcpy(str,p1->name);
for(j=0;j<strlen(str);j++)
{if(str[j]==t+65){printf("%d\n",p1->num);}
}
p1=p1->next;
}
}
int main()
{ struct student *p;
scanf("%d",&n);
p=creat();
list(p);
}
//???????????????????????str?????????A-Z??????a[0]-a[25]????a[]????b[],b[]?????????????????a[]?
//?b[]??a[0](?????)????????????????????
//????????????????????? ???????????? | 2 |
569 | int main()
{
int n;
cin>>n;
int book[1000];
char author[1000][10];
int i,j;
for(i=0;i<n;i++){
cin>>book[i]>>author[i];
}
int num[26]={0};
for(i=0;i<n;i++){
int length;
length=strlen(author[i]);
for(j=0;j<length;j++){
num[author[i][j]-'A']++;
}
}
int max=0;
char maxi;
for(i=0;i<26;i++){
if(num[i]>max){
max=num[i];
maxi='A'+i;
}
}
cout<<maxi<<endl;
int sum=0;
for(i=0;i<n;i++){
int length;
length=strlen(author[i]);
for(j=0;j<length;j++){
if(author[i][j]==maxi){
sum++;
}
}
}
cout<<sum<<endl;
for(i=0;i<n;i++){
int length;
length=strlen(author[i]);
for(j=0;j<length;j++){
if(author[i][j]==maxi){
cout<<book[i]<<endl;
}
}
}
return 0;
} | 2 |
570 |
void main()
{
struct book
{
char num[20];
char ren[30];
struct book *next;
};
int n;
int a[26]={0};
struct book *head,*p1,*p2;
int i,j;
char tem;
char b[100][30];
p1=(struct book *)malloc(L);
head=p1;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s%s",p1->num,p1->ren);
p2=p1;
p1=(struct book *)malloc(L);
p2->next=p1;
}
p1=head;
for(i=0;i<n;i++)
{
for(j=0;j<strlen(p1->ren);j++)
{
int t=p1->ren[j]-'A';
a[t]++;
}
p1=p1->next;
}
int max=0;
for(i=0;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
tem='A'+i;
}
}
printf("%c\n",tem);
p1=head;
int u=0;
for(i=0;i<n;i++)
{
for(j=0;j<strlen(p1->ren);j++)
{
if(p1->ren[j]==tem)
{
strcpy(b[u],p1->num);
u++;
}
}
p1=p1->next;
}
printf("%d\n",u);
for(i=0;i<u;i++)
{
printf("%s\n",b[i]);
}
} | 2 |
571 | int main()
{
int n,i,j,d[1000];
char zuo[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);
char s[1000][26],len;
int sum[26]={0},k;
for(i=0;i<n;i++)
{
scanf("%d%s",&d[i],s[i]);
len=strlen(s[i]);
for(j=0;j<len;j++)
{
for(k=0;k<26;k++)
{
if(s[i][j]=='A'+k) sum[k]++;
}
}
}
int max=0,count=0;
char maxid;
for(i=0;i<26;i++)
{
if(sum[i]>max)
{
max=sum[i];
maxid=i+'A';
}
}
printf("%c\n%d\n",maxid,max);
int t[1000];
for(i=0;i<n;i++)
{
len=strlen(s[i]);
for(j=0;j<len;j++)
{
if(s[i][j]==maxid)
{
count++;
t[count]=d[i];
}
}
}
for(i=1;i<=count;i++) printf("%d\n",t[i]);
return 0;
} | 2 |
572 |
int main()
{
int n,i,j,max=0;
int zuozhe[26]={0};
char maxer;
struct book
{
int num;
char author[26];
}
shu[1000];
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %s",&shu[i].num,shu[i].author);
for (j=0;j<26;j++)
zuozhe[shu[i].author[j]-65]++;
}
for (j=0;j<26;j++)
if (zuozhe[j]>max)
{
max=zuozhe[j];
maxer=j+65;
}
printf("%c\n%d\n",maxer,max);
for (i=0;i<n;i++)
for (j=0;j<26;j++)
if (shu[i].author[j]==maxer)
{
printf("%d\n",shu[i].num);
continue;
}
}
| 2 |
573 |
int main()
{
int n, i;
scanf("%d", &n);
struct
{
int name;
char author[26];
}
book[999];
for(i = 0; i < n; i++)
{
scanf("%d%s", &book[i].name, book[i].author);
}
char t, tmax;
int max = 0, j, k;
for(t = 'A'; t <= 'Z'; t++)
{
k = 0;
for(i = 0; i < n; i++)
{
for(j = 0; j < strlen(book[i].author); j++)
{
if(book[i].author[j] == t)
{
k++;
}
}
}
if(k > max)
{
max = k;
tmax = t;
}
}
printf("%c\n%d\n", tmax, max);
for(i = 0; i < n; i++)
{
for(j = 0; j < strlen(book[i].author); j++)
{
if(book[i].author[j] == tmax)
{
printf("%d\n", book[i].name);
break;
}
}
}
return 0;
} | 2 |
574 | 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 |
575 |
int main()
{
int m;
cin>>m;
int num[1001];
char name[1001][27];
for(int i=0;i<m;++i)
{
cin>>num[i];
cin.get();
cin.getline(name[i],27);
}
int count[100];memset(count, 0, sizeof(count));
int record[27][1000];
int start=0;
int i,j;
char call;
for( i=0;i<m;i++)
{
for( j=0;j<strlen(name[i]);j++)
{
count[name[i][j]]++;
//call=name[i][j]-'A';
//record[call][start++]=num[i];
}
}
int max=0,k=0;
char t;
for(char w = 'A';w<='Z';w++)
{
if(count[(int)w]>max)
{ max=count[(int)w];
t=w;
}
}
cout<<t<<endl;
cout<<max<<endl;
for( i=0;i<m;i++)
{
for( j=0;j<strlen(name[i]);j++)
{
if(name[i][j]==t)
{cout<<num[i]<<endl; continue; }
}
}
return 0;
}
| 2 |
576 | int main()
{
int n;
cin >> n;
int number[n+1];
int writer[26] = {0};
char book[n+1][27];
for(int i = 1; i <= n; ++i)
{
cin >> number[i] >> book[i];
for(int t = 0; t < strlen(book[i]); ++t)
{
writer[book[i][t] -'A']++;
}
}
int nn = 0;
for(int i = 0; i < 26; ++i)
{
nn = max(nn,writer[i]);
}
int person1;
for(int i = 0; i < 26; ++i)
{
if(writer[i] == nn)
{
person1 = i;
break;
}
}
char person = person1 + 'A';
cout << person << endl << nn << endl;
for(int i = 1; i <= n; ++i)
{
for(int t = 0; t < strlen(book[i]); ++t)
{
if(book[i][t] == person)
{
cout << number[i] << endl;
break;
}
}
}
//while(1);
return 0;
}
| 2 |
577 | void main()
{
int i,j,k,n,max;
int a[1000],b[26];
char name[1000][26];
scanf("%d",&n);
for(i=0;i<26;i++)
b[i]=0;
for(i=0;i<n;i++){
scanf("%d%s",&a[i],name[i]);
for(j=0;j<strlen(name[i]);j++)
b[name[i][j]-'A']++;
}
max=0;
for(k=1;k<26;k++)
if(b[k]>b[max])
max=k;
printf("%c\n%d\n",max+'A',b[max]);
for(i=0;i<n;i++)
for(j=0;j<strlen(name[i]);j++)
if(name[i][j]==max+'A'){
printf("%d\n",a[i]);
break;
}
} | 2 |
578 |
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 |
579 |
struct book
{
int number;
char name[26];
int num[26];
};
void mostbook(struct book *p)
{
int i,j,k;
k=strlen(p->name);
for(j=0;j<26;j++) //???num???
{
p->num[j]=0;
}
for(i=0;i<k;i++)
(p->num[(p->name[i]-'A')])++;
}
void main()
{
int i,j,m;
int max=0;
int maxi=0;
int s[26]={0};
//printf("???????:\n");
scanf("%d",&m);
struct book *p;
p=(struct book *)malloc(m*sizeof(struct book));
for(i=0;i<m;i++)
{
// printf("????????\n");
scanf("%d",&(p+i)->number);
scanf("%s",&(p+i)->name);
mostbook(p+i);
for(j=0;j<26;j++)
s[j]+=((p+i)->num[j]);
}
for(i=0;i<26;i++)
{
if(s[i]>=max)
{
max=s[i];
maxi=i;
}
}
//printf("????????\n");
printf("%c\n",(maxi+'A'));
//printf("?????\n");
printf("%d\n",max);
//printf("?????\n");
for(i=0;i<m;i++)
{
int k,j;
k=strlen((p+i)->name); //??i?book??
for(j=0;j<k;j++)
{
if((p+i)->name[j]==(maxi+'A')) //??i?book??
{
printf("%d\n",(p+i)->number);
continue; //????????????????continue
}
}
}
}
| 2 |
580 |
int main()
{
int n,book[1000],i,j,countt[26]={0},len,max=-1, maxauthor;
char peo[1000][27],sum[100000]="\0",ch;
cin >> n;
for(i=1;i<=n;i++)
{
cin >> book[i] >> peo[i];
strcat(sum,peo[i]);
}
len=strlen(sum);
for(i=0;i<len;i++)
countt[sum[i]-65]++;
for(i=0;i<26;i++)
if(countt[i]>max)
{
max=countt[i];
maxauthor = i;
}
ch=maxauthor+65;
int p=0,t=0;
for(i=1;i<=n;i++)
{
for(j=0;j<strlen(peo[i]);j++)
if(peo[i][j]==ch)
p++;
if(p>0)
book[i-t]=book[i];
else
t++;
p=0;
}
cout << ch << endl;
cout << n-t << endl;
for(i=1;i<=n-t;i++)
cout << book[i] << endl;
return 0;
}
| 2 |
581 | struct shu
{
int hao;
char zuo[26];
struct shu*next;
};
int main()
{
int m,a[26]={0},i,j,b[26][1000],k,max;
struct shu*p1,*p2,*head=NULL,*p;
scanf("%d",&m);
p1=p2=(struct shu*)malloc(len);
scanf("%d %s",&p1->hao,p1->zuo);
head=p1;
for(i=2;i<=m;i++)
{
p1=(struct shu*)malloc(len);
scanf("%d %s",&p1->hao,p1->zuo);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
for(i=0,max=0;i<=25;i++)
{
for(p=head,k=1;p!=NULL;p=p->next)
{
for(j=0;j<=25;j++)
if(p->zuo[j]=='A'+i)
{
a[i]++;
b[i][k]=p->hao;
k++;
}
}
if(a[i]>max)
max=a[i];
}
for(i=0;i<=25;i++)
{
if(a[i]==max)
{
printf("%c\n%d\n",'A'+i,max);
for(k=1;k<=max;k++)
printf("%d\n",b[i][k]);
break;
}
}
return 0;
} | 2 |
582 | int trans(char k)
{
int 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'};
for(i=0;i<26;i++)
{
if(k==a[i])
return i;
}
}
int main()
{
struct books
{
int n;
char w[27];
}*m;
int num,i,j;
scanf("%d",&num);
m=(struct books*)malloc(sizeof(struct books)*num);
for(i=0;i<num;i++)
{
int N;
char W[27];
scanf("%d %s",&N,W);
m[i].n=N;
strcpy(m[i].w,W);
}
int b[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},c;
for(i=0;i<num;i++)
{
for(j=0;m[i].w[j]!='\0';j++)
{
c=trans(m[i].w[j]);
b[c]++;
}
}
int max=0;
char most;
for(i=0;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
most='A'+i;
}
}
printf("%c\n%d\n",most,max);
for(i=0;i<num;i++)
{
for(j=0;m[i].w[j]!='\0';j++)
{
if(m[i].w[j]==most)
printf("%d\n",m[i].n);
}
}
return 0;
}
| 2 |
583 | struct worker
{
int name;
char au[20];
struct worker *next;
};
struct help
{
char author;
int max;
};
struct worker*creat(int m)
{
struct worker*p1,*p2,*p;
int i;
p1=p2=(struct worker *)malloc(sizeof(struct worker));
scanf("%d %s",&p1->name,p1->au);
p=p1;
for(i=0;i<m-1;i++)
{
p1=(struct worker *)malloc(sizeof(struct worker));
scanf("%d %s",&p1->name,p1->au);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return p;
}
void print(struct worker *p)
{
struct worker *p1;
p1=p;
while(p1!=NULL)
{
printf("%d %s\n",p1->name,p1->au);
p1=p1->next;
}
}
void most(struct worker *p)
{
struct worker *p1,*p2;
int a[30]={0},i,max;
char author;
struct help t;
p1=p;
p2=p;
while(p1!=NULL)
{
for(i=0;*(p1->au+i)!='\0';i++)
{
a[*(p1->au+i)-65]=a[*(p1->au+i)-65]+1;
}
p1=p1->next;
}
for(i=0,max=0;i<26;i++)
{
if(a[i]>max) max=a[i];
}
for(i=0;i<26;i++)
{
if(a[i]==max) author=i+65;
}
printf("%c\n%d\n",author,max);
p1=p;
while(p1!=NULL)
{
for(i=0;*(p1->au+i)!='\0';i++)
{
if(*(p1->au+i)==author) printf("%d\n",p1->name);
}
p1=p1->next;
}
}
void main()
{
struct worker *p1,*p;
struct help t;
int m;
char c;
scanf("%d",&m);
p=creat(m);
p1=p;
//print(p1);
most(p1);
}
| 2 |
584 |
int m,n;
struct student
{
int id;
char name[100];
struct student* next;
};
struct student *creat()
{
int i=1;
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(len);
scanf("%d",&m);
scanf("%d %s",&p1->id,p1->name);
head=NULL;
for(;i<m;i++)
{
if(i==1) head=p1;
p1=(struct student*)malloc(len);
scanf("%d %s",&p1->id,p1->name);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return(head);
}
void main()
{
struct student *head,*p1;
int num[30]={0},max,j;
char i,auth;
head=creat();
for(p1=head;p1!=NULL;p1=p1->next)
{
for(i='A';i<='Z';i++)
{
for(j=0;j<strlen(p1->name);j++)
if(p1->name[j]==i)
num[i-'A']++;
}
}
for(i=0,max=0;i<26;i++)
{
if(num[i]>max)
{
max=num[i];
auth=i+'A';
}
}
printf("%c\n",auth);
printf("%d\n",max);
for(p1=head;p1!=NULL;p1=p1->next)
{
for(j=0;j<strlen(p1->name);j++)
if(p1->name[j]==auth)
printf("%d\n",p1->id);
}
}
| 2 |
585 | 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 |
586 | struct book
{
int H;
char writer[26];
}b[max];
int main()
{
int m,i,j,k,sum[26]={0},t,Max,g;
char y;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&b[i].H,b[i].writer);
t=strlen(b[i].writer);
for(j=0;j<t;j++)
{
k=b[i].writer[j]-65;
sum[k]++;
}
}
Max=sum[0];
for(i=0;i<26;i++)
{
if(sum[i]>Max)
Max=sum[i];
}
for(i=0;i<26;i++)
{
if(sum[i]==Max)
{
y=i+65;
printf("%c\n%d\n",y,Max);
}
}
for(i=0;i<m;i++)
{
g=0;
t=strlen(b[i].writer);
for(j=0;j<t;j++)
{
if(b[i].writer[j]==y)
{
g++;
break;
}
}
if(g!=0)
printf("%d\n",b[i].H);
}
return 0;
}
| 2 |
587 | void main()
{
int m,a[1000],l[1000],i,j,k,t,time[26]={0},max,q=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'};
char b[1000][26];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i],b[i]);
l[i]=strlen(b[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<l[i];j++)
{
for(k=0;k<26;k++)
{
if(b[i][j]==name[k]) time[k]++;
}
}
}
max=time[0];
for(i=1;i<26;i++)
{
if(time[i]>max)
{
max=time[i];
t=i;
}
}
printf("%c\n",name[t]);
printf("%d\n",max);
for(i=0;i<m;i++)
{
for(j=0;j<l[i];j++)
{
if(b[i][j]==name[t])
{
printf("%d\n",a[i]);
}
}
}
} | 2 |
588 |
int main() {
struct book1 {
int num;
char author[20];
} book[999];
int time[26]={0};
int n, i, j, k, maxi, sign=0;
scanf("%d", &n);
for (i=0;i<n;i++) {
scanf("%d%s", &book[i].num, book[i].author);
}
for (i=0;i<n;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
for (k=0;k<26;k++) {
if (book[i].author[j]=='A'+k) {
time[k]+=1;
break;
}
}
}
}
maxi=0;
for(i=0;i<26;i++) {
if (time[maxi]<time[i]) {
maxi=i;
}
}
printf("%c\n%d\n", 'A'+maxi, time[maxi]);
for (i=0;i<n&&sign==0;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
if (book[i].author[j]=='A'+maxi) {
printf("\n%d", book[i].num);
sign=1;
break;
}
}
}
for (;i<n;i++) {
for (j=0;book[i].author[j]!='\0';j++) {
if (book[i].author[j]=='A'+maxi) {
printf("\n%d", book[i].num);
break;
}
}
}
return 0;
} | 2 |
589 |
int main(int argc, char* argv[])
{
char m = 0;
int cnt[255], i, j, n;
struct {
int id;
char au[32];
} bk[1000];
memset(cnt, 0, sizeof(cnt));
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[m])
m = bk[i].au[j];
}
printf("%c\n%d\n", m, cnt[m]);
for (i = 0; i < n; i++)
if (strchr(bk[i].au, m))
printf("%d\n", bk[i].id);
return 0;
}
| 2 |
590 | struct book
{
int a;
char b[30];
struct book *next;
};
void main()
{
int m,i,j,k,mid,l=0;
int d[26],e[26];
char c[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct book *head,*p1,*p2;
scanf("%d",&m);
head=p1=p2=(struct book *)malloc(LEN);
for(i=0;i<m;i++)
{
scanf("%d %s",&p1->a,p1->b);
p1=(struct book *)malloc(LEN);
p2->next=p1;
p2=p1;
}
p1=head;
for(j=0;j<26;j++)
{
p1=head;
l=0;
for(i=0;i<m;i++)
{
for(k=0;k<strlen(p1->b);k++)
{
if(p1->b[k]==c[j])l++;
}
d[j]=l;e[j]=l;
p1=p1->next;
}
}
for(i=0;i<25;i++)
for(j=0;j<25-i;j++)
{
if(d[j]<d[j+1])
{
mid=d[j];d[j]=d[j+1];d[j+1]=mid;
}
}
for(i=0;i<26;i++)
{
if(e[i]==d[0])break;
}
printf("%c\n",c[i]);
printf("%d\n",d[0]);
p1=head;
for(j=0;j<m;j++)
{
for(k=0;k<strlen(p1->b);k++)
{
if(p1->b[k]==c[i])printf("%d\n",p1->a);
}
p1=p1->next;
}
}
| 2 |
591 | struct book
{
int num;
char author[26];
struct book *next;
};
void main()
{
int m,i,j,l,max,maxi;int n[26]={0};
struct book *head,*p1,*p2;char *p;
scanf("%d",&m);
i=0;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->author);
head=NULL;
while(i<m)
{
i++;
if(i==1)
head=p1;
else
p2->next=p1;
p2=p1;
if(i<m)
{
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->author);
}
}
p2->next=NULL;
p1=head;
while(p1!=NULL)
{
l=strlen(p1->author);
p=p1->author;
for(i=0;i<l;i++)
{
for(j=0;j<26;j++)
if(*(p+i)==j+64)
n[j]++;
}
p1=p1->next;
}
max=n[0];
for(i=1;i<26;i++)
{
if(n[i]>max)
{
max=n[i];
maxi=i;
}
}
printf("%c\n",maxi+64);
printf("%d\n",max);
p1=head;
while(p1!=NULL)
{
l=strlen(p1->author);
p=p1->author;
for(i=0;i<l;i++)
{
if(*(p+i)==maxi+64)
{
printf("%d\n",p1->num);
break;
}
}
p1=p1->next;
}
} | 2 |
592 | struct book
{ int n;
char name[26];
struct book *next;
};
struct book *head;
int m;
struct book *creat()
{struct book *p1,*p2;
int i=0;
p1=p2=(struct book*)malloc(LEN);
scanf("%d %s",&p1->n,p1->name);
head=NULL;
while(i<m-1)
{i=i+1;
if(i==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->n,p1->name);
}
p2->next=p1;
p1->next=NULL;
return(head);
}
void main()
{
int i,j,*p,max=0,n;
struct book *p1;
p=(int*)calloc(26,sizeof(int));
scanf("%d",&m);
creat();
p1=head;
for(i=65;i<=90;i++)
{
p1=head;
do
{
for(j=0;(p1->name)[j]!='\0';j++)
if((p1->name)[j]==i) *(p+i-65)=*(p+i-65)+1;
p1=p1->next;
}while(p1!=NULL);
}
for(i=0;i<26;i++,p++)
{
if(*p>max)
{
max=*p;
n=i;
}
}
printf("%c\n",n+65);
printf("%d\n",max);
p1=head;
do
{
for(j=0;(p1->name)[j]!='\0';j++)
{
if((p1->name)[j]==n+65)
printf("%d\n",p1->n);
}
p1=p1->next;
}while(p1!=NULL);
}
| 2 |
593 |
int cishu[26];
struct shu
{
int num;
char name[26];
struct shu *next;
};
struct shu *app(int n)
{
int i,len,j;
struct shu *newnode ,*p, *head;
for(i=1;i<=n;i++)
{
newnode=(struct shu *)malloc(sizeof(struct shu));
scanf("%d %s", &newnode->num , newnode->name );
len=strlen(newnode->name );
for(j=0;j<len;j++)
{
cishu[newnode->name[j]-'A']++;
}
if(i==1)
{
head=newnode;
}
else
{
p->next =newnode;
}
p=newnode;
}
p->next =0;
return head;
}
int max(void)
{
int m=0, i ,x;
for(i=0;i<26;i++)
{
if(cishu[i]>m)
{m=cishu[i];
x=i;}
}
return x;
}
int cunzai(char a[],int kk)
{
int l,i;
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]==kk+'A')
return 1;
}
return 0;
}
int main()
{
int n,kk;
struct shu *head, *p;
scanf("%d",&n);
head=app(n);
kk=max();
printf("%c\n%d\n", 'A'+kk, cishu[kk]);
for(p=head;p!=0;p=p->next )
{
if(cunzai(p->name ,kk))
{printf("%d\n",p->num );}
}
return 0;
}
| 2 |
594 | struct
{
char z[30];
int n;
}s[1000];
struct
{
int name;
int nb,b[1000],k;
}r[93];
int main()
{
int m,i,j,l,q;
for(i=65;i<=90;i++)
{
r[i].name=i;
r[i].k=1;
}
scanf("%d",&m);
for(i=1;i<=m;i++)
{
scanf("%d %s",&s[i].n,s[i].z);
l=strlen(s[i].z);
for(j=0;j<l;j++)
{
q=s[i].z[j];
r[q].nb++;
r[q].b[r[q].k]=s[i].n;
r[q].k++;
}
}
for(i=65;i<90;i++)
for (j=90;j>i;j--)
if (r[j].nb>r[j-1].nb)
{
r[92]=r[j];
r[j]=r[j-1];
r[j-1]=r[92];
}
printf("%c\n%d\n",r[65].name,r[65].nb);
for (i=1;i<=r[65].nb;i++)
printf("%d\n",r[65].b[i]);
}
| 2 |
595 | 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 |
596 | void main()
{
struct x
{
char num[26];
int y;
}q[1000],x0;
int n,i,j,c[100]={0},m=0,f;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d %s",&q[i].y,&q[i].num);}
for(i=0;i<n;i++)
for(j=0;q[i].num[j]!='\0';j++)
m=(int)q[i].num[j],c[m]=c[m]+1;
for(m=0;m<100;m++)
if(c[m]>c[0])
f=m,c[0]=c[m];
printf("%c\n%d\n",(char)f,c[f]);
for(i=0;i<n;i++)
for(j=0;q[i].num[j]!='\0';j++)
if(q[i].num[j]==(char)f)
printf("%d\n",q[i].y);
} | 2 |
597 | int Book_num(char a[])
{
int j,num;
j=1;
if((j=1)&&a[j]==' ')
{
num=a[0]-48;
}
else j++;
if((j=2)&&a[j]==' ')
{
num=a[1]-48+(a[0]-48)*10;
}
else j++;
if((j=3)&&a[j]==' ')
{
num=a[2]-48+(a[1]-48)*10+(a[0]-48)*100;
}
return num;
}
int main()
{
int m,bk1,i,max,j,wrt;
int author[26][999]={0};
char data[999][30];
scanf("%d\n",&m);
for(i=0;i<m;i++)
{
gets(data[i]);
data[i][strlen(data[i])]='\0';
}
max=0;
for(i=0;i<m;i++)
{
for(j=0;data[i][j]!='\0';j++)
{
if(data[i][j]>64)
{
wrt=data[i][j]-65;
for(bk1=0;author[wrt][bk1]!=0;bk1++)
{;}
author[wrt][bk1]=Book_num(data[i]);
if(bk1>max)
{
max=bk1;
}
}
}
}
for(i=0;i<26;i++)
{
if(author[i][max]!=0)
{
printf("%c\n",i+65);
printf("%d\n",max+1);
for(j=0;j<=max;j++)
{
printf("%d\n",author[i][j]);
}
break;
}
}
return 0;
}
| 2 |
598 | struct book
{
int ISBN;
char name[26];
}b[999];
int main()
{
int i,j,m,k[26],max=0;
char a,d='A';
for(i=0;i<26;i++)
k[i]=0;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&b[i].ISBN,b[i].name);
for(a='A';a<='Z';a++)
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(b[i].name[j]==a)
k[a-'A']++;
for(i=0;i<26;i++)
if(k[i]>=max)
max=k[i];
for(i=0;i<26;i++)
if(k[i]==max)
{
d+=i;
printf("%c\n",d);
printf("%d\n",max);
}
for(i=0;i<m;i++)
for(j=0;j<26;j++)
if(b[i].name[j]==d)
printf("%d\n",b[i].ISBN);
return 0;
} | 2 |
599 | struct book
{
char num[4];
char author[26];
}book[999];
int main()
{
int n;
scanf ("%d", &n);
int i,j;
int a;
char c;
int max=0;
for (i=0;i<=n-1;i++)
{
scanf ("%s %s", &book[i].num, book[i].author);
}
int s[26];
for (i=0;i<=25;i++)
{
s[i]=0;
}
for (i=0;i<=n-1;i++)
{
for (j=0;j<=25;j++)
{
if (0<=(book[i].author[j]-'A')&&(book[i].author[j]-'A')<=25)
{
a=book[i].author[j]-'A';
s[a]=s[a]+1;
}
}
}
for (i=0;i<=25;i++)
{
if (max<s[i])
{
max=s[i];
}
}
for (i=0;i<=25;i++)
{
if (max==s[i])
{
c='A'+i;
}
}
printf ("%c\n", c);
printf ("%d\n", max);
for (i=0;i<=n-1;i++)
{
for (j=0;j<=25;j++)
{
if (book[i].author[j]==c)
{
printf ("%s\n", book[i].num);
}
}
}
return 0;
}
| 2 |