label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
---|---|---|
2 | 800 |
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 | 801 | struct{
int location[1001];
int num;
int sum;
}ans[27];
int main()
{
int n,value=-1,order,m;
char s[28];
cin>>n;
for(int i=1;i<=26;i++)
{
ans[i].num=ans[i].sum=0;
}
for(int i=1;i<=n;i++)
{
cin>>m;
cin>>s;
for(int j=0;j<strlen(s);j++)
{
ans[s[j]-'A'+1].num++;
ans[s[j]-'A'+1].sum++;
ans[s[j]-'A'+1].location[ans[s[j]-'A'+1].num]=m;
}
}
for(int i=1;i<=26;i++)
if(ans[i].sum>value)
{
value=ans[i].sum;
order=i;
}
cout<<(char)(order+'A'-1)<<endl;
cout<<ans[order].num<<endl;
for(int i=1;i<=ans[order].num;i++)
cout<<ans[order].location[i]<<endl;
return 0;
}
|
2 | 802 | struct sa
{
int a;
char b[100];
struct sa *next;
};
int n,m,k[27];
struct sa *kao(void)
{
struct sa *head;
struct sa *p1,*p2;
n=0;
head=NULL;
p1=p2=(struct sa *)malloc(len);
scanf("%d %s",&p1->a,p1->b);
head=p1;
for(;;)
{
n++;
if(n==m+1)
break;
if(n==1)
head=p1;
else
{
p2=p1;
p1=(struct sa *)malloc(len);
scanf("%d %s",&p1->a,p1->b);
p2->next=p1;
}
}
p1->next=NULL;
return (head);
}
int main()
{
struct sa *p,*q,*head,*ped;
int f,i,g,s=1,t,d=0;
char c;
scanf("%d",&m);
head=kao();
for(p=head;p!=NULL;p=p->next)
{
g=strlen(p->b);
for(i=0;i<g;i++)
{
k[p->b[i]-64]++;
}
}
t=k[1];
for(i=2;i<27;i++)
{
if(k[i]>k[s])
{s=i;t=k[i];}
}
printf("%c\n%d\n",s+64,t);
for(p=head;p!=NULL;)
{
g=strlen(p->b);
for(i=0;i<g;i++)
{
if(p->b[i]==s+64)
{
d=1;break;
}
}
if(d==1)
printf("%d\n",p->a);
d=0;
p=p->next;
}
return 0;
}
|
2 | 803 | void main()
{
struct book
{
int num;
char auth[26];
int inf[26];
struct book *next;
};
struct book *head,*p1,*p2,*t1,*t2;
head=(struct book *)malloc(sizeof(struct book));
int m,i,k,l,j,max;
int authnum[26]={0};
scanf("%d",&m);
p1=head;
p2=p1;
for (i=0;i<(m-1);i++)
{
scanf("%d %s",&(p1->num),p1->auth);
p2=(struct book *)malloc(sizeof(struct book));
p1->next=p2;
p1=p2;
}
scanf("%d %s",&(p1->num),p1->auth);
p2=NULL;
p1->next=p2;
p1=head;
p2=p1;
while(p1!=NULL)
{
l=strlen(p1->auth);
for(j=0;j<l;j++)
{
p1->inf[(*((p1->auth)+j))-65]=1;
authnum[(*((p1->auth)+j))-65]++;
}
p2=p1->next;
p1=p2;
}
max=0;
for(i=1;i<26;i++)
{
if (authnum[i]>authnum[max]) max=i;
}
printf("%c\n",(max+65));
printf("%d\n",authnum[max]);
p1=head;
p2=p1;
while(p1!=NULL)
{
if ((p1->inf[max])>0)
printf("%d\n",p1->num);
p2=p1->next;
p1=p2;
}
p1=head;
p2=p1;
while(p1!=NULL)
{
p2=p1->next;
free(p1);
p1=p2;
}
} |
2 | 804 | struct book{
int name;
char writer[100];
struct book *next;
};
int a[26];
struct book *creat(int n)
{
struct book *p1,*p2,*xhead;
p1=(struct book*)malloc(len);
scanf("%d %s",&p1->name,p1->writer);
p2=p1;
xhead=p1;
while(n-1)
{
n--;
p1=(struct book *)malloc(len);
scanf("%d %s",&p1->name,p1->writer);
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return xhead;
}
void find(struct book*head)
{
struct book *p;
int i;
char s[100];
p=head;
while(p)
{
i=0;
strcpy(s,p->writer);
while(s[i]!='\0')
{a[s[i]-'A']++;
i++;
}
p=p->next;
}
}
void print(struct book *head,int max)
{
struct book *p;
p=head;
while(p)
{
if(strchr(p->writer,max+'A')) printf("%d\n",p->name);
p=p->next;
}
}
void main()
{
int i,max=0,n;
struct book *head;
memset(a,0,sizeof(a));
scanf("%d",&n);
head=creat(n);
find (head);
for(i=0;i<26;i++)
if(a[i]>a[max]) max=i;
printf("%c\n",max+'A');
printf("%d\n",a[max]);
print(head,max);
}
|
2 | 805 | main()
{
int m,n,j,k,id[1001],a[26]={0};
char c[1001][26],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(j=1;j<=n;j++) {scanf("%d %s",&id[j],&c[j]);}
for(m=0;m<26;m++)
{
for(j=1;j<=n;j++)
{
for(k=0;k<26;k++) {if(b[m]==c[j][k]) a[m]=a[m]+1;}
}
}
int t=0,r=0;
for(m=0;m<=25;m++)
{
if(t<a[m]) {t=a[m];r=m;}
}
printf("%c\n%d",b[r],a[r]);
for(j=1;j<=n;j++)
{
for(k=0;k<26;k++)
{
if(c[j][k]==b[r]) printf("\n%d",id[j]);
}
}
} |
2 | 806 |
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 | 807 |
void main()
{
int num=0,n,a[26],name[1000],name2[1000],i,j,k,max=0,maxi=0;
char wr[1000][27];
char q;
scanf("%d",&n);
for (i=0;i<26;i++)
{
a[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%d%s",&(name[i]),wr[i]);
for (j=0;j<26;j++)
{
for (k=0;k<26;k++)
{
if (wr[i][j]=='A'+k) a[k]++;
}
}
}
for (i=0;i<26;i++)
{
if (a[i]>max)
{
max=a[i];
maxi=i;
}
}
q='A'+maxi;
printf("%c\n",q);
for (i=0;i<n;i++)
{
for (j=0;j<26;j++)
{
if (wr[i][j]==q)
{
name2[num]=name[i];
num++;
}
}
}
printf("%d\n",num);
for (i=0;i<num;i++) printf("%d\n",name2[i]);
} |
2 | 808 |
int main ()
{
int m;
cin >> m;
char writter[27];
int data[26][1000];
memset(data,0,sizeof(data));
int max = 0;
char max_name;
for (int i = 1; i <= m; i++){
int number;
cin >> number >> writter;
for (int j = 0; j < strlen(writter); j++){
data[writter[j]-65][0]++;
data[writter[j]-65][data[writter[j]-65][0]] = number;
if (max < data[writter[j]-65][0]){
max = data[writter[j]-65][0];
max_name = writter[j];
}
}
}
cout << max_name << endl << max << endl;
for (int i = 1; i <= max; i++)
cout << data[max_name - 65][i] << endl;
return 0;
} |
2 | 809 | struct book
{
int num;
char name[26];
}book[1000];
int judge(char*a,int b);
int main(int argc, char* argv[])
{
char c;
int n=0,i=0,j=0,rec[26]={0},k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&book[i].num,book[i].name);
}//????
for(i=0;i<26;i++)//??i??????
{
for(j=0;j<n;j++)//??j?????
{
if(judge(book[j].name,i)==1)//???j????????i
{rec[i]++;}//??i?????????rec[i]?????????
}//??????????i??????????
}//?????????26??????????????
j=0;//j??????????????????
k=rec[0];//k??????????????
for(i=0;i<25;i++)
{
if(k<rec[i])
{
j=i;
k=rec[i];
}
}
c='A'+j;
printf("%c\n%d\n",c,k);
for(i=0;i<n;i++)
{
if(judge(book[i].name,j)==1)
{printf("%d\n",book[i].num);}
}
return 0;
}
int judge(char*a,int b)
{
int i=0;
for(i=0;i<26;i++)
{
if(a[i]=='A'+b)
return 1;
}
return 0;
}
|
2 | 810 | struct stu
{
int num;
char c[26];
struct stu*next;
};
struct stu*create(void)
{
struct stu *p1,*p2,*head;
int m;
scanf("%d",&m);
p1=(struct stu*)malloc(LEN);
scanf("%d %s",&p1->num,p1->c);
p2=p1;
head=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 head;
}
void print(struct stu*head,int z)
{
struct stu*q;
int i,k;
char s[20],s0[20]={'\0'};
q=head;
while(q)
{
strcpy(s,q->c);
k=strlen(s);
for(i=0;i<k;i++)
if(s[i]==z+65)
{
printf("%d\n",q->num);
break;
}
strcpy(s,s0);
q=q->next;
}
}
void main()
{
int index;
int a[26],k,t,i,max=0;
char s[20],s0[20]={'\0'};
struct stu*p,*head;
memset(a,0,sizeof(a));
head=create();
p=head;
while(p)
{
strcpy(s,p->c);
k=strlen(s);
for(i=0;i<k;i++)
{
t=s[i]-65;
a[t]++;
}
strcpy(s,s0);
p=p->next;
}
for(i=0;i<26;i++)
if(a[i]>max)
{
max=a[i];
index=i;
}
printf("%c\n%d\n",index+65,max);
print(head,index);
}
|
2 | 811 | struct data
{
int no;
char au[10];
};
void main()
{
struct data lib[1000];
char x;
int n,i,j,num[26]={0},l[1000],k,max;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&lib[i].no);
scanf("%s",lib[i].au);
l[i]=strlen(lib[i].au);
}
for(i=0;i<n;i++)
{
for(j=0;j<l[i];j++)
{
num[lib[i].au[j]-65]=num[lib[i].au[j]-65]+1;
}
}
max=num[0];
for(i=0;i<26;i++)
{
if(num[i]>max)
{
max=num[i];
k=i;
}
}
printf("%c\n",k+65);
printf("%d\n",max);
x=k+65;
for(i=0;i<n;i++)
{
for(j=0;j<l[i];j++)
{
if(lib[i].au[j]==x)
printf("%d\n",lib[i].no);
}
}
} |
2 | 812 |
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 | 813 | struct tushu{
int bianhao;
char writer[27];
}book[1000];
void jishu(struct tushu *p1,int a[26],int b);
int max(int c[26]);
void shu(struct tushu *p2,int d,int e);
int main(){
int n,i,m;
int zimu[26];
struct tushu *pointer;
pointer=&book[0];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&book[i].bianhao,&book[i].writer);
}
jishu(pointer,zimu,n);
m=max(zimu);
shu(pointer,m,n);
return 0;
}
void jishu(struct tushu *p1,int a[26],int b){
int j,k,diji;
for(j=0;j<26;j++){
a[j]=0;
}
for(j=0;j<b;j++){
k=0;
do{
diji=(*(p1+j)).writer[k]-'A';
a[diji]++;
k++;
}while((*(p1+j)).writer[k]!='\0');
}
}
int max(int c[26]){
int k,da,jieguo=0;
da=c[0];
for(k=1;k<26;k++){
if(c[k]>da){
da=c[k];
jieguo=k;
}
}
printf("%c\n%d\n",65+jieguo,da);
return(jieguo);
}
void shu(struct tushu *p2,int d,int e){
char ai=65+d;
int x,y;
for(x=0;x<e;x++){
y=0;
do{
if((*(p2+x)).writer[y]==ai){
printf("%d\n",(p2+x)->bianhao);
}
y++;
}while((*(p2+x)).writer[y]!='\0');
}
}
|
2 | 814 | struct book
{
int num;
char wr[26];
struct book *next;
};
void main()
{
int i,n,m=0,j,a,b,c;
int s[100]={0};
scanf("%d",&n);
struct book *head,*p1,*p2,*p;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->wr);
head=NULL;
while(m!=n-1)
{
m=m+1;
if(m==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->wr);
}
p2->next=p1;
p2=p1;
p2->next=NULL;
p=head;
do
{
b=strlen(p->wr);
for(j=0;j<b;j++)
s[p->wr[j]]++;
p=p->next;
}while(p!=NULL);
a=s[65];
c=65;
for(i=66;i<91;i++)
if(a<s[i])
{
a=s[i];
c=i;
}
printf("%c\n%d\n",c,a);
p=head;
do
{
b=strlen(p->wr);
for(j=0;j<b;j++)
if(p->wr[j]==c)
printf("%d\n",p->num);
p=p->next;
}while(p!=NULL);
} |
2 | 815 |
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);
struct Author
{
int count;
int number[1000];
};
struct Author b[26];
for(i=0;i<26;i++) b[i].count=0;
int max,record;
for (i=0;i<m;i++)
{
int k;
k=strlen(a[i].auther);
for (j=0;j<k;j++)
{
b[a[i].auther[j]-'A'].number[b[a[i].auther[j]-'A'].count]=a[i].number;
b[a[i].auther[j]-'A'].count++;
}
}
max=b[0].count;
for (i=0;i<26;i++)
if (b[i].count>=max)
{
max=b[i].count;
record=i;
}
printf("%c\n%d\n",record+'A',max);
for (i=0;i<max;i++)
printf("%d\n",b[record].number[i]);
return 0;
} |
2 | 816 | int main()
{
int m,i,b[26],p,max,j,c;
scanf ("%d",&m);
struct point
{
int n;
char s[26];
}a[999];
for (i=0;i<m;i++)
{
scanf ("%d %s",&a[i].n,a[i].s);
}
for (i=0;i<26;i++)
{
b[i]=0;
}
for (i=0;i<m;i++)
{
for (j=0;a[i].s[j]!='\0';j++)
{
if (a[i].s[j]=='A')
b[0]++;
else if (a[i].s[j]=='B')
b[1]++;
else if (a[i].s[j]=='C')
b[2]++;
else if (a[i].s[j]=='D')
b[3]++;
else if (a[i].s[j]=='E')
b[4]++;
else if (a[i].s[j]=='f')
b[5]++;
else if (a[i].s[j]=='G')
b[6]++;
else if (a[i].s[j]=='H')
b[7]++;
else if (a[i].s[j]=='I')
b[8]++;
else if (a[i].s[j]=='J')
b[9]++;
else if (a[i].s[j]=='K')
b[10]++;
else if (a[i].s[j]=='L')
b[11]++;
else if (a[i].s[j]=='M')
b[12]++;
else if (a[i].s[j]=='N')
b[13]++;
else if (a[i].s[j]=='O')
b[14]++;
else if (a[i].s[j]=='P')
b[15]++;
else if (a[i].s[j]=='Q')
b[16]++;
else if (a[i].s[j]=='R')
b[17]++;
else if (a[i].s[j]=='S')
b[18]++;
else if (a[i].s[j]=='T')
b[19]++;
else if (a[i].s[j]=='U')
b[20]++;
else if (a[i].s[j]=='V')
b[21]++;
else if (a[i].s[j]=='W')
b[22]++;
else if (a[i].s[j]=='X')
b[23]++;
else if (a[i].s[j]=='Y')
b[24]++;
else if (a[i].s[j]=='Z')
b[25]++;
}
}
p=0;
max=b[0];
for (i=0;i<26;i++)
{
if (b[i]>max)
{
p=i;
max=b[i];
}
}
c=(p+'A');
printf ("%c\n%d\n",c,max);
for (i=0;i<m;i++)
{
for (j=0;a[i].s[j]!='\0';j++)
{
if (a[i].s[j]==(p+'A'))
printf("%d\n",a[i].n);
}
}
return 0;
}
|
2 | 817 | struct book
{
int id;
char writer[30];
}book[1200];
int main()
{
int n,l,t,a[30];
char m;
cin>>n;
for(int i=0;i<30;i++) a[i]=0;
for(int i=0;i<n;i++)
{
cin>>book[i].id>>book[i].writer;
l=strlen(book[i].writer);
for(int j=0;j<l;j++)
{
t=book[i].writer[j]-65;
a[t]++;
}
}
t=a[0];l=0;
for(int i=0;i<26;i++)
{
if(a[i]>t)
{
l=i;
t=a[i];
}
}
m=l+65;
cout<<m<<endl;
cout<<t<<endl;
for(int i=0;i<30;i++) a[i]=0;
for(int i=0;i<n;i++)
{
l=strlen(book[i].writer);
for(int j=0;j<l;j++)
{
if(book[i].writer[j]==m)
cout<<book[i].id<<endl;
}
}
return 0;
} |
2 | 818 | /*????????m?10 ? m ? 999??????????n?2 ? n ? 26?
????????????????m?????????1?999???????????'A'?'Z'??
??????????????????????????????*/
void main()
{
int i,j,n,m,x[26]={0},y=0,z;
char a[100][4],b[100][10],c;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %s",a[i],b[i]);
}
for(i=0;i<n;i++)
{
m=strlen(b[i]);
for(j=0;j<m;j++)
{
x[b[i][j]-65]++;
}
}
for(i=0;i<26;i++)
{
if(y<x[i])
{
y=x[i];
z=i;
}
}
c=z+65;
printf("%c\n%d\n",c,y);
for(i=0;i<n;i++)
{
m=strlen(b[i]);
y=0;
for(j=0;j<m;j++)
{
if(b[i][j]==c)y=1;
}
if(y==1)printf("%s\n",a[i]);
}
} |
2 | 819 | struct s
{
long h;//??????????
char z[1000];
struct s *next;
};
struct s *create(int n)
{
struct s *head,*p1,*p2;
int i=0;
p1=p2=(struct s *)malloc(len);
scanf("%ld %s",&p1->h,p1->z);//???????????????????
head=0;
while(i<n-1)//???????
{
i++;
if(i==1) head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct s *)malloc(len);
scanf("%ld %s",&p1->h,p1->z);
}
p2->next=p1;
p1->next=0;
return head;
}
void main()
{
int m,i,n,num[26]={0},j;
struct s *p1,*head;
char c,*p2;
scanf("%d",&n);
head=create(n);
p1=head;
for(i=0;i<n;i++)
{
for(p2=p1->z;*p2!='\0';p2++)
{
j=*p2-65;
num[j]++;
}
p1=p1->next;
}
m=num[0];
j=0;
for(i=0;i<26;i++)
{
if(num[i]>m)
{
m=num[i];
j=i;
}
}
c=j+65;
printf("%c\n",c);
printf("%d\n",num[j]);
p1=head;
for(i=0;i<n;i++)
{
for(p2=p1->z;*p2!='\0';p2++)
{
if(*p2==c)
{
printf("%ld\n",p1->h);
break;
}
}
p1=p1->next;
}
}
|
2 | 820 | 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 | 821 |
int main()
{
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 | 822 | 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 | 823 | struct book
{
int id;
char writer[26];
int length;
}zz[999];
int main()
{
int n,i,j,k;
int letter[26]={0};
int letter_book[26][999]={0};
cin>>n;
for ( i = 0 ; i < n; i ++ )
{
cin>>zz[i].id;
cin>>zz[i].writer;
zz[i].length=strlen(zz[i].writer);
}
for ( j = 0 ; j < n ; j ++ )
{
for ( k = 0 ; k < zz[j].length ; k ++ )
{
letter_book[zz[j].writer[k] - 'A'][letter[zz[j].writer[k] - 'A']] = zz[j].id;
letter[zz[j].writer[k] - 'A'] ++;
}
}
int max=0,t;
for ( i = 0 ; i < 26 ; i ++ )
{
if ( letter[i] > max )
{
max = letter[i];
t = i;
}
}
char m;
m = 'A' + t ;
cout<<m<<endl;
cout<<max<<endl;
for ( i = 0 ; i < max ; i ++ )
cout<<letter_book[t][i]<<endl;
} |
2 | 824 | int n=1,m;
struct zuozhe
{int num;
char ren[26];
struct zuozhe *next;
};
struct zuozhe *ap()
{
struct zuozhe * head,*nw,*tn;
do
{
nw=(struct zuozhe *)malloc(sizeof(struct zuozhe));
scanf("%d%s",&nw->num ,nw->ren );
if(n==1)
{
head=nw;
tn=head;
}
else
tn->next=nw;
if(n<=m)
{
tn=nw;
n++;
}
}while(n<=m);
tn->next =NULL;
return head;
}
int main()
{
int i,max=0,a[26]={0},j,w,l;
char z;
struct zuozhe *head,*p;
scanf("%d",&m);
head=ap();
p=head;
for(;p!=NULL;p=p->next )
{
l=strlen(p->ren );
for(i=0;i<l;i++)
{
j=p->ren [i]-65;
a[j]++;
}
}
for(i=0;i<26;i++)
{
if(max<a[i])
{
max=a[i];
w=i;
}
}
z=65+w;
printf("%c\n%d\n",z,max);
p=head;
for(;p!=NULL;p=p->next )
{
l=strlen(p->ren );
for(i=0;i<l;i++)
{
if(p->ren [i]==z)
{
printf("%d\n",p->num );
break;
}
}
}
} |
2 | 825 | //????
int main()
{
int a,s[26][1000],m,i,j,author,max=0;//a????
char b[1000][28];//???
for (i=0;i<26;i++)
s[i][0]=0;
cin>>m;
for (i=0;i<m;i++)
{
cin>>a;
cin>>b[a];
for (j=0;b[a][j]!='\0';j++)
{
s[b[a][j]-'A'][0]++;//??????+1
s[b[a][j]-'A'][s[b[a][j]-'A'][0]]=a;//??????
}
}
for (i=0;i<26;i++)
{
if (s[i][0]>max)
{
max=s[i][0];
author=i;
}
}
cout<<(char)(author+'A')<<endl<<max<<endl;
for (j=1;j<=max;j++)
cout<<s[author][j]<<endl;
return 0;
} |
2 | 826 | struct info
{
int num;
char author[30];
struct info *next;
};
struct info*create(int n)
{
struct info *p1,*p2,*head;
int i;
p1=(struct info*)malloc(sizeof(struct info));
scanf("%d%s",&p1->num,p1->author);
p1->next=NULL;
p2=p1;
head=p1;
i=1;
while(i<n)
{
p1=(struct info*)malloc(sizeof(struct info));
scanf("%d%s",&p1->num,p1->author);
p1->next=NULL;
p2->next=p1;
p2=p1;
i++;
}
return head;
}
int main()
{
int n,i,t,index,j;
struct info *head,*p;
int *g;
scanf("%d",&n);
head=create(n);
g=(int*)malloc(26*sizeof(int));
p=head;
for(i=0,t=0;i<26;i++)
{
*(g+i)=0;
}
for(i=0;i<n;i++)
{
j=0;
while(*(p->author+j)!='\0')
{(*(g+(*(p->author+j))-65))++;j++;}
p=p->next;
}
for(i=0,t=0;i<26;i++)
{
if(*(g+i)>t)
{t=*(g+i);index=i;}
}
printf("%c\n",index+65);
printf("%d\n",*(g+index));
p=head;
for(i=0;i<n;i++)
{
j=0;
while(*(p->author+j)!='\0')
{if(*(p->author+j)==index+65)
{printf("%d\n",p->num);}
j++;
}
p=p->next;
}
} |
2 | 827 |
struct data{
int code;
char author[20];
};
struct letter{
char let;
int count;
};
int main()
{
int n,i,j,k,t,max;
struct data a[100];
struct letter l[26];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i].code);
gets(a[i].author);
}
for(i=0;i<26;i++)
{
l[i].let=i+65;
l[i].count=0;
}
for(i=0;i<n;i++)
{
for(j=0;a[i].author[j]!='\0';j++)
{
for(k=0;k<26;k++)
{
if(a[i].author[j]==l[k].let)
l[k].count++;
}
}
}
max=0;
for(k=0;k<26;k++) {
if(l[k].count>max)
{ max=l[k].count;
t=k;}
}
printf("%c\n",l[t].let);
printf("%d\n",l[t].count);
for(i=0;i<=n-1;i++)
{
for(j=0;a[i].author[j]!='\0';j++)
{
if(a[i].author[j]==l[t].let)
printf("%d\n",a[i].code);
}
}
return 0;
}
|
2 | 828 | void main()
{
int max(int b[26]);
int n,a[100]={0},b[26]={0},i,j,m;
char zuo[26]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
char shu[100][10]={0},c;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i],shu[i]);
}
for(i=0;i<26;i++)
{
for(j=0;j<n;j++)
{
if(strchr(shu[j],zuo[i])) b[i]=b[i]+1;
}
}
m=max(b);
for(i=0;i<26;i++)
{
if(b[i]==m)
{
printf("%c\n",zuo[i]);
printf("%d\n",b[i]);
c=zuo[i];
}
}
for(i=0;i<n;i++)
{
if(strchr(shu[i],c))
{
printf("%d\n",a[i]);
}
}
}
int max(int b[26])
{
int i,m=0;
for(i=0;i<26;i++)
{
if(m<b[i])m=b[i];
}
return(m);
} |
2 | 829 | struct book
{
int num;
char author[26];
};
int main()
{
int n;
scanf("%d\n",&n);
int i;
struct book book[1000];
for(i=0;i<n;i++)
{
scanf("%d %s",&book[i].num,book[i].author);
}
int b[26]={0};
for(i=0;i<n;i++)
{
int l;
l=strlen(book[i].author);
int j;
for(j=0;j<l;j++)
{
b[book[i].author[j]-65]=b[book[i].author[j]-65]+1;
}
}
int max=b[0];
for(i=0;i<26;i++)
{
if(b[i]>max) max=b[i];
}
for(i=0;i<26;i++)
{
if(b[i]==max) break;
}
char p;
p=i+65;
printf("%c\n%d\n",p,max);
for(i=0;i<n;i++)
{ int j,l;
l=strlen(book[i].author);
for(j=0;j<l;j++)
{
if(book[i].author[j]==p) {printf("%d\n",book[i].num);break;}
else if(book[i].author[j]!=p&&j==l-1) break;
}
}
return 0;
}/*????????*/
|
2 | 830 |
struct BOOK
{
int num;
char author[26];
};
char maxbook(int a[])
{
int i,j,bookmax=0;
for(i=0;i<26;i++){
if(bookmax<a[i]){
bookmax=a[i];
j=i;
}
}
printf("%c\n%d\n",'A'+j,bookmax);
return 'A'+j;
}
int contain(char author[],char max)
{
char *c=author;
while(*c){
if(*c==max) return 1;
c++;
}
return 0;
}
void main()
{
struct BOOK book[1000];
int m,i,j;
char c,max;
int AtoZ[26]={0};
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&book[i].num);
getchar();
j=0;
while((c=getchar())!='\n'){
book[i].author[j]=c;
AtoZ[c-'A']++;
j++;
}
book[i].author[j]='\0';
}
max=maxbook(AtoZ);
for(i=0;i<m;i++){
if(contain(book[i].author,max))
printf("%d\n",book[i].num);
}
}
|
2 | 831 | 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 | 832 | 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 | 833 | int main()
{
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};
int m,i,j,k,num[10000],max=0,t=0;
char a[10000][26];
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'};
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&num[i]);
scanf("%s",&a[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
for(k=0;k<26;k++)
{
if(a[i][j]==c[k])
b[k]++;
}
}
}
for(i=0;i<26;i++)
{
if(b[i]>max)
{
max=b[i];
t=i;
}
}
printf("%c\n",c[t]);
printf("%d\n",max);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(a[i][j]==c[t])
{
printf("%d\n",num[i]);
break;
}
}
}
getchar();
getchar();
return 0;
} |
2 | 834 | struct student
{
char number[100];
char name[100];
struct student*next;
};
int n;
struct student*creat(void)
{
struct student *head;
struct student *p1,*p2;
int i=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s",&p1->number,&p1->name);
head=NULL;
do
{
i=i+1;
if(i==1)head=p1;else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s %s",&p1->number,&p1->name);
}
while(i<n-1);
p2->next=p1;
p2=p1;
p2->next=NULL;
return(head);
}
void main()
{
int h,i,k,m,j,max;
struct student*head;
struct student*p;
int sum[10000]={0};
scanf("%d",&n);
head=creat();/*????*/
p=head;
for(i=65,k=0;i<=90;i++,k++)/*???????????????*/
{
p=head;
do
{
m=strlen(p->name);
for(j=0;j<m;j++)
{
if(p->name[j]==i)sum[k]++;
}
p=p->next;
}while(p!=NULL);
}
for(i=0,max=sum[0];i<=k;i++)
{
if(sum[i]>=max){h=i;max=sum[i];}/*??????????????????????????????????????*/
}
printf("%c\n%d\n",h+65,max);/*???????????max??????sum[i]?????*/
p=head;
do
{
m=strlen(p->name);
for(j=0;j<m;j++)
{
if(p->name[j]==h+65)printf("%s\n",p->number);
}
p=p->next;
}while(p!=NULL);
}
/*?????????????????????????????????????????????????????????????????
???????????????????????????????????????????*/ |
2 | 835 | int main()
{
int m,i,j,k,q=0,t=0,u,max;
int b[26]={0};
char c[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct as{
int sh;
char a[26];
}cla[1000];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %s",&cla[i].sh,cla[i].a);
t=(int)strlen(cla[i].a);
for(k=0;k<t;k++){
u=cla[i].a[k]-'A';
b[u]++;
}
}
max=0;
for(j=0;j<25;j++)
if(max<b[j]){
max=b[j];
q=j;
}
printf("%c\n",c[q]);
printf("%d\n",max);
for(i=0;i<m;i++){
t=(int)strlen(cla[i].a);
for(k=0;k<t;k++)
if(cla[i].a[k]==c[q])
printf("%d\n",cla[i].sh);
}
return 0;
}
|
2 | 836 | 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 | 837 | struct su
{
int a;
char b[26];
struct su *next;
};
int main()
{
int n,c[26]={0},i,k,j,l,max,m;
struct su *p,*head,*q;
scanf("%d",&n);
for(i=0;i<n;i++)
{
p=(struct su *)malloc(sizeof(struct su));
if(i==0)
{head=p;
q=p;
scanf("%d %s",&p->a,p->b);
k=strlen(p->b);
for(j=0;j<k;j++)
{
l=p->b[j]-'A';
c[l]=c[l]+1;
}
}
else
{ q->next=p;
q=p;
scanf("%d %s",&p->a,p->b);
k=strlen(p->b);
for(j=0;j<k;j++)
{
l=p->b[j]-'A';
c[l]=c[l]+1;
}
}
}
q->next=NULL;
max=c[0];
m=0;
for(j=0;j<26;j++)
{
if(max<c[j])
{max=c[j];
m=j;
}
}
printf("%c\n%d\n",m+'A',max);
p=head;
do
{
k=strlen(p->b);
for(j=0;j<k;j++)
{
if(('A'+m)==p->b[j])
{
printf("%d\n",p->a);
}
}
p=p->next;
}while(p!=NULL);
return 0;
} |
2 | 838 | 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 | 839 | int main()
{struct book{
int num;
char s[26];
}b[1000];
struct author{
int n[1000];
int p;
char c;
}a[26],e;
int i,j,k,m,q,max;
char d;
for(i=0;i<26;i++)
a[i].p=0;
for(i=0,d='A';i<26;i++,d++)
{a[i].c=d;}
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&b[i].num,b[i].s);}
for(i=0;i<m;i++)
{for(j=0;;j++)
{if(b[i].s[j]=='\0')
break;
for(k=0;k<26;k++)
{if(b[i].s[j]==a[k].c)
{a[k].n[a[k].p]=b[i].num;
a[k].p+=1;}}}}
max=a[0].p;
e=a[0];
for(i=0;i<26;i++)
{if(a[i].p>max)
{e=a[i];max=a[i].p;}}
printf("%c\n",e.c);
printf("%d\n",e.p);
for(j=0;j<e.p;j++)
printf("%d\n",e.n[j]);}
|
2 | 840 | void main()
{
int n,i,j,k,a[1000],max=0,t,p[26]={0};
char c[1000][27],d,l[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&a[i],c[i]);
for(i=0;i<n;i++)
for(j=0;j<strlen(c[i]);j++)
for(k=0;k<26;k++){
if(c[i][j]==l[k])
p[k]+=1;
}
for(k=0;k<26;k++)
if(p[k]>max){max=p[k];t=k;}
printf("%c\n%d\n",l[t],max);
for(i=0;i<n;i++)
for(j=0;j<strlen(c[i]);j++)
if(c[i][j]==l[t]){
printf("%d\n",a[i]);
break;}
}
|
2 | 841 | 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 | 842 | 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 | 843 | struct book
{
int name;
char writer[26];
};
void main()
{
struct book data[999];
int m,i,j,max=0,b=0;
int a[26]={0};
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&data[i].name,data[i].writer);
for(i=0;i<m;i++)
for(j=0;j<strlen(data[i].writer);j++)
a[data[i].writer[j]-'A']++;
for(i=0;i<26;i++)
if(a[i]>max)
{max=a[i];
b=i;}
printf("%c\n%d\n",('A'+b),max);
for(i=0;i<m;i++)
for(j=0;j<strlen(data[i].writer);j++)
{if(data[i].writer[j]==('A'+b))
{
printf("%d\n",data[i].name);
break;}
}
} |
2 | 844 | struct author
{
char name;
int count;
}aut[26];
int max(struct author a[26])
{
int i,max;
max=a[0].count;
for(i=0;i<26;i++)
if(a[i].count>max)
max=a[i].count;
return(max);
}
void main()
{
int m,h=0;
scanf("%d",&m);
int i,j,n,l[1000],book_name[1000];
char author_name[1000][27];
for(i=0;i<26;i++)
{
aut[i].name='A'+i;
aut[i].count=0;
}
for(i=0;i<m;i++)
{
scanf("%d%s",&book_name[i],author_name[i]);
l[i]=strlen(author_name[i]);
for(j=0;j<26;j++)
for(n=0;n<l[i];n++)
if(author_name[i][n]==aut[j].name)
aut[j].count++;
}
for(i=0;i<26;i++)
{
if(aut[i].count==max(aut))
{
printf("%c\n",aut[i].name);
h=i;
}
}
printf("%d\n",max(aut));
for(i=0;i<m;i++)
{
l[i]=strlen(author_name[i]);
for(n=0;n<l[i];n++)
if(author_name[i][n]==aut[h].name)
printf("%d\n",book_name[i]);
}
} |
2 | 845 |
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 | 846 | 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-1)
{ t++;
p2->next=p1;
p2=p1;
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p1->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 | 847 | int main ()
{
int n,i,j,m,t,g,max;
char q;
int d[26];
struct
{
int a;
char b[26];
}s[999];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&s[i].a,s[i].b);
}
for(i=0;i<26;i++)
{
d[i]=0;
}
for(i=0;i<n;i++)
{
m=strlen(s[i].b);
for(j=0;j<m;j++)
{
t=s[i].b[j]-'A';
d[t]++;
}
}
max=0;
for(j=0;j<25;j++)
{
if(d[j]>max)
{
max=d[j];
g=j;
}
}
q='A'+g;
printf("%c\n%d\n",q,max);
for(i=0;i<n;i++)
{
m=strlen(s[i].b);
for(j=0;j<m;j++)
{
if(s[i].b[j]-'A'==g)
{
printf("%d\n",s[i].a);
}
}
}
return 0;
}
|
2 | 848 | struct Student
{char name[26];
int a;
};
int main()
{
int n,i,k,l,m;
char j,t;
int b[26]={0};
scanf ("%d",&n);
struct Student stu[999];
for (i=0;i<n;i++)
{
scanf ("%d %s",&stu[i].a,stu[i].name);
}
for (j='A',k=0;j<='Z';j++,k++)
for (i=0;i<n;i++)
for (l=0;l<26;l++)
if (stu[i].name[l]==j)
b[k]++;
for (j='A',k=0,m=0;j<='Z';j++,k++)
if (b[k]>m)
{
m=b[k];
t=j;
}
printf ("%c\n%d",t,m);
for (i=0;i<n;i++)
for (l=0;l<26;l++)
if (stu[i].name[l]==t)
printf ("\n%d",stu[i].a);
return 0;
} |
2 | 849 | int main()
{
char mo='A';
int a[ASC]={0};
int i,j,n;
struct
{ int num;
char wr[MAX_N+1];
}book[MAX_M];
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%s",&book[i].num,book[i].wr);
for(j=0;book[i].wr[j];j++)
{if(++a[book[i].wr[j]]>a[mo]) mo=book[i].wr[j];}
}
printf("%c\n%d\n",mo,a[mo]);
for(i=0;i<n;i++)
if(strchr(book[i].wr,mo)) printf("%d\n",book[i].num);
return 0;
}
|
2 | 850 | void main()
{
int n,i,c[26]={0},d[26]={0},j,s,t,k;
char b[26000],r,max;
scanf("%d\n",&n);
struct book
{
int num;
char author[26];
}a[999];
for(i=0;i<n;i++) scanf("%d %s\n",&a[i].num,&a[i].author);
strcpy(b,a[0].author);
for(i=1;i<n;i++) strcat(b,a[i].author);
s=strlen(b);
for(r='A',j=0;r<='Z',j<26;r++,j++)
for(i=0;i<s;i++) if(b[i]==r) c[j]++;
for(i=0;i<26;i++) d[i]=c[i];
for(j=0;j<25;j++)
for(i=0;i<25-j;i++)
if(d[i]<d[i+1]) {t=d[i];d[i]=d[i+1];d[i+1]=t;}
k=d[0];
for(i=0;i<26;i++) if(c[i]==k) max=i+65;
printf("%c\n%d\n",max,k);
for(i=0;i<n;i++)
for(j=0;j<26;j++)
if(a[i].author[j]==max) printf("%d\n",a[i].num);
}
|
2 | 851 | void main()
{
int n,i,j,t[26]={0},k=0,max,h;
scanf("%d",&n);
struct book
{
int a;
char b[26];
}book[100]={0,""};
for(i=0;i<n;i++)
{
scanf("%d%s",&book[i].a,book[i].b);
}
for(i=0;i<n;i++)
{
k=strlen(book[i].b);
for(j=0;j<k;j++)
{
t[book[i].b[j]-65]++;
}
}
max=0;
for(i=0;i<26;i++)
{
//printf("%d ",t[i]);
if(t[i]>max)
{ max=t[i];
h=i;
}
}
printf("%c\n%d\n",h+65,max);
for(i=0;i<n;i++)
{
k=strlen(book[i].b);
for(j=0;j<k;j++)
{
if(book[i].b[j]==h+65)
printf("%d\n",book[i].a);
}
}
} |
2 | 852 | int main()
{
int n;
int i,j,k;
int max,max2;
int a[26];
struct book
{
int number;
char author[26];
}stu1[1000];
struct author
{
int number[1000];
int ben;
}stu2[26];
scanf("%d",&n);
for(i=0;i<=n-1;i++)
scanf("%d %s",&stu1[i].number,stu1[i].author);
for(i=0;i<=25;i++)
{
stu2[i].ben=0;
a[i]=0;
} //???
for(i=0;i<=n-1;i++)
{
for(j=0;j<=strlen(stu1[i].author)-1;j++)//j????????
{
k=stu1[i].author[j];//k???????? ?A?
stu2[k-65].ben++;//stu2[x]???1
stu2[k-65].number[a[k-65]]=stu1[i].number;//??????????????
a[k-65]++;//?????1
}
}
max=stu2[0].ben;
max2=0;//?A?????
for(i=1;i<=25;i++)
{
if(stu2[i].ben>max)
{
max=stu2[i].ben;
max2=i;//?????????
}
}
printf("%c\n",max2+65);
printf("%d\n",max);
for(j=0;j<=a[max2]-1;j++) //????+1? ????
printf("%d\n",stu2[max2].number[j]);
return 0;
}
|
2 | 853 | 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 | 854 | 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 | 855 | int main(){
int n,i,j,max=0,b[1000],p[26];
char *bm[1000];
scanf("%d",&n);
for(i=0;i<26;i++)
p[i]=0;
for(i=0;i<n;i++){
scanf("%d",&b[i]);
bm[i]=(char *)malloc(26*sizeof(char));
scanf("%s",bm[i]);
for(j=0;j<strlen(bm[i]);j++){
p[(int)(*(bm[i]+j)-'A')]++;
}
}
for(i=0;i<26;i++){
if(p[i]>p[max])
max=i;
}
printf("%c\n",(char)('A'+max));
printf("%d\n",p[max]);
for(i=0;i<n;i++){
for(j=0;j<strlen(bm[i]);j++){
if(bm[i][j]==(char)('A'+max)){
printf("%d\n",b[i]); break;
}
}
}
return 1;
} |
2 | 856 | int main()
{
int m,len[1000],sum[26]={0},max,i,j,i0;
scanf("%d",&m);
struct book{
int num;
char wri[27];
}book[1000];
for(i=0;i<m;i++){
scanf("%d %s",&book[i].num,book[i].wri);
len[i]=strlen(book[i].wri);
}
for(i=0;i<m;i++)
for(j=0;j<len[i];j++)
sum[book[i].wri[j]-65]++;
max=sum[0];
i0=0;
for(i=1;i<26;i++)
if(sum[i]>max){
max=sum[i];
i0=i;
}
printf("%c\n",i0+65);
printf("%d\n",max);
for(i=0;i<m;i++)
for(j=0;j<len[i];j++)
if(book[i].wri[j]==65+i0){
printf("%d\n",book[i].num);
break;
}
return 0;
} |
2 | 857 |
struct author{
char num[4];
char str[27];
};
int main(int argc, char* argv[])
{
int m,i,j,zimu[26]={0},x,max;
char p;
scanf("%d",&m);
struct author *auth=(struct author *)malloc(sizeof(struct author)*m);
for(i=0;i<m;i++){
scanf("%s %s",auth[i].num,auth[i].str);
}
for(i=0;i<m;i++){
for(j=0;j<26;j++){
x=auth[i].str[j]-65;
zimu[x]++;
}
}
max=zimu[0];
for(i=0;i<26;i++){
if(zimu[i]>max){
max=zimu[i];
p=i;
}
}
printf("%c\n%d\n",p+65,max);
for(i=0;i<m;i++){
for(j=0;j<26;j++){
if(auth[i].str[j]==p+65){
printf("%s\n",auth[i].num);
}
}
}
free(auth);
return 0;
} |
2 | 858 | int m;
struct book
{
int num;
char name[26];
struct book *next;
};
struct book *create(void)
{
struct book *head,*p1,*p2;
int i;
scanf("%d",&m);
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
for(i=1;i<m;i++)
{
if(i==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p1->next=NULL;
return(head);
}
void main()
{
int num[26]={0},i,j,max=0;
struct book *p1,*p2,*head;
char *p;
p1=create();
head=p1;
for(i=0;i<m;i++)
{
for(p=p1->name;*p!='\0';p++)
{
num[(*p)-'A']++;
}
p1=p1->next;
}
for(i=0;i<26;i++)
{
if(num[i]>max)
{
max=num[i];
j=i;
}
}
printf("%c\n",('A'+j));
printf("%d\n",max);
p1=head;
for(i=0;i<m;i++)
{
p=p1->name;
for(p=p1->name;*p!='\0';p++)
{
if(*p==('A'+j))
{
printf("%d\n",p1->num);
break;
}
}
p1=p1->next;
}
} |
2 | 859 |
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 | 860 | void main()
{
int m,num[1000],i,k,l=0,a[26]={0};
char nam[1000][10],j;
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d%s",&num[i],nam[i]);
for(j='A';j<='Z';j++)
for(i=0;i<m;i++)
if(strchr(nam[i],j))
a[j-65]++;
for(i=0,k=a[0];i<26;i++)
if(a[i]>k)
{
k=a[i];
l=i;
}
printf("%c\n",l+65);
printf("%d\n",k);
for(i=0;i<m;i++)
{
if(strchr(nam[i],l+65))
printf("%d\n",num[i]);
}
}
|
2 | 861 |
struct student
{
int num;
char zz[20];
struct student *next;
};
struct student *New(int n)
{
struct student *head=NULL;
struct student *newp, *thisp;
int i=0;
do
{
newp=(struct student*)malloc(sizeof(struct student));
if (newp==NULL)
{
printf("request failed\n");
exit(-1);
}
scanf("%d %s",&newp->num,newp->zz);
if (i==0)
{
head = newp;
thisp = head;
}
else
thisp->next = newp;
if (i<n)//????????
{
thisp = newp;
i=i+1;
}
}while(i<n);
thisp->next=NULL;
return (head);
}
void main()
{
int i,j;
int n;
int t1=0,t2;
int length;
char target[1000]={' '};
char mz=' ';
struct student *head, *p;
scanf("%d",&n);
head=New(n);
p=head;
i=0;
do
{
if (i==0)
{
strcpy(target,p->zz);
}
else
{
p = p->next;
strcat(target,p->zz);
}
i+=1;
}while(p->next != NULL);
length=strlen(target);
for(i=0;i<length;i++)//??????
{
t2=0;
if (target[i]=='0')
continue;
else
{
for (j=i+1;j<length;j++)
{
if (target[j]==target[i])
{
target[j]='0';
t2+=1;
}
}
if (t2>t1)
{
t1=t2;
mz=target[i];
}
}
}
printf("%c\n%d",mz,t1+1);
p=head;
do
{
length=strlen(p->zz);
for (i=0;i<length;i++)
{
if ((p->zz[i])==mz)
{
printf("\n%d",p->num);
}
}
p = p->next;
}while(p != NULL);
}
|
2 | 862 | struct a{
int n;
char s[26];
}b[1000];
int main()
{
int n,i,j,c[26]={0};
char t;
scanf("%d",&n);
for (i=0;i<n;i++)
{
int d,m;
scanf("%d%s",&b[i].n,b[i].s);
d=strlen(b[i].s);
for(m=0;m<d;m++)
c[b[i].s[m]-65]+=1;
}
for(i=0;i<26;i++)
{
for(j=i+1;j<26;j++)
if(c[j]>c[i])
break;
if(j==26)
break;
}
t=65+i;
printf("%c\n%d\n",t,c[i]);
for(i=0;i<n;i++)
{
if(strchr(b[i].s,t)!=NULL)
printf("%d\n",b[i].n);
}
return 0;
} |
2 | 863 | int main()
{
int i,j,temp=26,n,p[27]={0};
struct {
int a;
char s[30];
}t[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&t[i].a,t[i].s);
for(j=0;j<strlen(t[i].s);j++)
{
p[t[i].s[j]-'A']++;
}
}
for(i=0;i<26;i++)
{
if(p[i]>p[temp])
temp=i;
}
printf("%c\n%d\n",temp+'A',p[temp]);
for(i=0;i<n;i++)
{
for(j=0;j<strlen(t[i].s);j++)
{
if(t[i].s[j]==temp+'A')
{
printf("%d\n",t[i].a);
break;
}
}
}
return 0;
} |
2 | 864 | struct book
{
int num;
char name[27];
}b[1001];
void main()
{
int n,i,j,k,d,g[27],e=0,f=0,l;
char m,h;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %s",&b[i].num,b[i].name);
m='A';
for(k=0;k<26;k++)
{
d=0;
for(i=0;i<n;i++)
{
for(j=0;j<26;j++)
{
if(b[i].name[j]==m)
d++;
if(b[i].name[j]=='\0')
break;
}
}
m=m+1;
g[k]=d;
if(g[k]>e)
{
e=g[k];
f=k;
}
}
h='A'+f;
printf("%c\n%d\n",h,e);
for(i=0;i<n;i++)
{
d=0;
for(j=0;j<26;j++)
{
if(b[i].name[j]==h)
d++;
if(b[i].name[j]=='\0')
break;
}
if(d!=0)
printf("%d\n",b[i].num);
}
} |
2 | 865 | struct book
{
int ID;
char author[30];
struct book *next;
};
int n,max=0;
char c;
struct book *create()
{
struct book *head,*p1,*p2;
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->ID,p1->author);
head=p1;
p2=p1;
p1->next=NULL;
int i=1;
do
{
if(i==n)break;
p1=(struct book*)malloc(LEN);
scanf("%d %s",&p1->ID,p1->author);
p2->next=p1;
p2=p1;
p1->next=NULL;
i++;
}while(1);
return(head);
}
int main()
{
struct book *head;
int i;
int *num;
num=(int*)malloc(26*sizeof(int));
for(i=0;i<26;i++)
*(num+i)=0;
scanf("%d",&n);
head=create();
struct book *p;
char *s;
p=head;
while(p)
{
for(s=p->author;*s!='\0';s++)
{
int temp;
temp=*s-'A';
(*(num+temp))++;
}
p=p->next;
}
for(i=0;i<26;i++)
{
if(*(num+i)>max)max=*(num+i);
}
for(i=0;i<26;i++)
{
if(*(num+i)==max)break;
}
printf("%c\n%d\n",'A'+i,max);
c='A'+i;
p=head;
while(p)
{
for(s=p->author;*s!='\0';s++)
{
if(*s==c)break;
}
if(*s!='\0')printf("%d\n",p->ID);
p=p->next;
}
}
|
2 | 866 | int main()
{struct book
{int m;
char au[26];}b[999];
int m,n[26],M=0,i,j;
scanf("%d",&m);
for(i=0;i<26;i++)
n[i]=0;
for(i=0;i<m;i++)
scanf("%d %s",&b[i].m,b[i].au);
for(i=0;i<m;i++)
for(j=0;b[i].au[j]!='\0';j++)
n[b[i].au[j]-65]++;
for(i=1;i<26;i++)
if(n[M]<n[i]) M=i;
printf("%c\n%d",M+65,n[M]);
for(i=0;i<m;i++)
for(j=0;b[i].au[j]!='\0';j++)
if(b[i].au[j]==M+65) printf("\n%d",b[i].m);
return 0;}
|
2 | 867 | 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 | 868 | struct book
{ int id;
char aut[26];
};
int main()
{
int m,n,i,j,k;
int a[27]={0};
struct book cal[1001];
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d%s",&cal[i].id,cal[i].aut);
}
for(j=65;j<91;j++)
{ for(i=0;i<m;i++)
{ for(k=0;k<27;k++)
{ if(cal[i].aut[k]==j)
a[j-65]++;
}
}
}
int max=0,t;
for(i=0;i<26;i++)
{
if(a[i]>max)
{ max=a[i];
t=i;
}
}
printf("%c\n%d\n",t+65,max);
for(i=0;i<m;i++)
{
for(j=0;j<26;j++)
{
if(cal[i].aut[j]==t+65)
printf("%d\n",cal[i].id);
}
}
return 0;
} |
2 | 869 | struct book
{
int id;
char s[26];
}a[100];
int main()
{
int m,i,n,j,k,max,maxnum;
int aut1[26]={0},aut2[26][100]={0};
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&a[i].id);
gets(a[i].s);
n=strlen(a[i].s);
for(j=0;j<n;j++)
{
k=a[i].s[j]-'A';
aut2[k][aut1[k]]=a[i].id;
aut1[k]++;
}
}
max=0;maxnum=0;
for(i=0;i<26;i++)
{
if(aut1[i]>max)
{
max=aut1[i];
maxnum=i;
}
}
printf("%c\n",'A'+maxnum);
printf("%d\n",max);
printf("%d",aut2[maxnum][0]);
for(i=1;i<max;i++)
{
printf("\n%d",aut2[maxnum][i]);
}
}
|
2 | 870 | struct student
{
long num;
char str[27];
struct student *next;
};
int n;
struct student *creat(int m)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%ld %s",&p1->num,p1->str);
head=0;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%d %s",&p1->num,p1->str);
}
p2->next=0;
return(head);
}
void main()
{
struct student *head,*p,stu;
int m,i,t,max,y=1,a[100]={0},sum[27]={0};
char x=1,c;
scanf("%d",&m);
head=creat(m);
p=head;
for(;p!=0;p=p->next)
{
for(t=0;t<strlen(p->str);t++)
{
c=p->str[t];
sum[c-64]++;
}
}
max=sum[1];
for(i=1;i<=26;i++)
if(sum[i]>max){max=sum[i];x=i;}
for(p=head;p!=0;p=p->next)
{
for(t=0;t<=strlen(p->str);t++)
if(p->str[t]==x+64)a[y]=p->num;
y++;
}
printf("%c\n%d\n",x+64,max);
for(y=1;y<=99;y++)
if(a[y]!=0)printf("%d\n",a[y]);
}
|
2 | 871 | void main()
{
struct shu
{
int bian;
char name[26];
};
struct shu a[1000];
int n,i,j,l[1000],b[26]={0},most,good,k;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d%s",&a[i].bian,a[i].name);
for(i=0;i<n;i++)
l[i]=strlen(a[i].name);
for(i=0;i<n;i++)
for(j=0;j<l[i];j++)
for(k=0;k<26;k++)
if(a[i].name[j]==65+k)
b[k]++;
most=b[0];
for(i=0;i<26;i++)
if(b[i]>most)
{
most=b[i];
good=i;
}
printf("%c\n",65+good);
printf("%d\n",most);
for(i=0;i<n;i++)
for(j=0;j<26;j++)
if(a[i].name[j]==65+good)
printf("%d\n",a[i].bian);
}
|
2 | 872 | void main()
{
int a[999],m,i,j,c[26],max=0,d,k;
scanf("%d\n",&m);
for(k=0;k<26;k++)
{
c[k]=0;
}
struct books
{
int num;
char name[26];
}
books[999];
for(i=0;i<m;i++)
{
scanf("%d %s",&books[i].num,books[i].name);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
c[books[i].name[j]-'A']++;
}
}
for(k=0;k<26;k++)
{
if(c[k]>max)
{
max=c[k];
d=k;
}
}
printf("%c\n%d\n",d+'A',max);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
if(books[i].name[j]==d+'A')
{
printf("%d\n",books[i].num);
break;
}
}
}
} |
2 | 873 |
void main()
{
int m,t,len,a[26][MAX]={0},n[26]={0},max=0,num;
int i,j;
char s[27];
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %s",&t,s);
len=strlen(s);
for(j=0;j<len;j++){
n[s[j]-65]++;
a[s[j]-65][i]=t;
}
}
for(j=0;j<26;j++){
if(n[j]>max){
max=n[j];
num=j;
}
}
printf("%c\n%d\n",num+65,n[num]);
for(i=0;i<m;i++){
if(a[num][i]!=0)
printf("%d\n",a[num][i]);
}
} |
2 | 874 | int main()
{
int m,i,j,x,maxnumber;
scanf("%d",&m);
int booknum[1000];
char k[1000][30];
int author[27]={0};
for(i=1;i<=m;i++)
{
scanf("%d %s",&booknum[i],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<=m;i++)
{
for(j=0;j<strlen(k[i]);j++)
if(k[i][j]==who)
printf("%d\n",booknum[i]);
}
return 0;
}
|
2 | 875 | 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 | 876 | 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 | 877 | struct book
{ char name[20];
int num;
struct book *next;
};
struct book *creat(int m)
{
int i;
struct book *head,*p1,*p2;
p1=(struct book *)malloc(len);
scanf("%d",&p1->num);
scanf("%s",p1->name);
p1->next=null;
head=p1;
p2=p1;
for(i=1;i<m;i++)
{
p1=(struct book *)malloc(len);
scanf("%d",&p1->num);
scanf("%s",p1->name);
p1->next=null;
p2->next=p1;
p2=p1;
}
return(head);
}
void main()
{
struct book *p,*head;
int i,a[26],m;
char *q;
scanf("%d",&m);
head=creat(m);
p=head;
char s[30];
for(i=0;i<26;i++)
a[i]=0;
while(p){
i=0;
strcpy(s,p->name);
while(s[i]!='\0')
{
a[s[i]-'A']++;
i++;
}
p=p->next;
}
/* for(i=0;i<26;i++)
printf("%d",a[i]);*/
//??
int max=0,max_p;
for(i=0;i<26;i++)
{
if(a[i]>max) {max=a[i];max_p=i+'A';}
}
printf("%c\n%d\n",max_p,max);
//find max
p=head;
int x=0;
char c[20];
while(p){
i=0;
strcpy(c,p->name);
while(c[i]!='\0')
{
if(c[i]==max_p) x=1;
i++;
}
if(x==1) printf("%d\n",p->num);
x=0;
p=p->next;
//if(strchr(p->name,max_p)) printf("%d\n",p->num);
}
//??
}
|
2 | 878 | 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 | 879 |
struct inf
{
int num;
char wri[27];
struct inf *next;
};
void main()
{
int n,i,time[26]={0};
//for(i=0;i<26;i++)
// printf("%d",time[i]);
char *pn;
struct inf *head,*p1,*p0,*p;
scanf("%d",&n);
p1 = head = (struct inf*)malloc(sizeof(struct inf));
for (i=0;i<n;i++)
{
p0 = (struct inf*)malloc(sizeof(struct inf));
scanf("%d%s",&p0->num,p0->wri);
p0->next = NULL;
p1->next=p0;
p1=p0;
pn=p0->wri;
while(*pn!='\0')
{
time[*pn-65]++;
pn=pn+1;
}
}
int max=0,k;
for (i=0;i<26;i++)
{
if (time[i]>max)
{
max=time[i];
k=i;
}
}
printf("%c\n%d\n",k+65,max);
p=head;
while(p!=NULL)
{
pn=p->wri;
while(*pn!='\0')
{
if (*pn==k+65)
{
printf("%d\n",p->num);
break;
}
pn=pn+1;
}
p=p->next;
}
// printf("%d",p->num);
} |
2 | 880 | void main()
{
int m,i,j,temp,max;
char a[1000][10],b[1000][20],w;
int c[26];
scanf("%d",&m);
for(i=0;i<26;i++) c[i]=0;
for(i=0;i<m;i++)
{
scanf("%s %s",a[i],b[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(b[i]);j++)
{
if(b[i][j]=='A') c[0]++;
if(b[i][j]=='B') c[1]++;
if(b[i][j]=='C') c[2]++;
if(b[i][j]=='D') c[3]++;
if(b[i][j]=='E') c[4]++;
if(b[i][j]=='F') c[5]++;
if(b[i][j]=='G') c[6]++;
if(b[i][j]=='H') c[7]++;
if(b[i][j]=='I') c[8]++;
if(b[i][j]=='J') c[9]++;
if(b[i][j]=='K') c[10]++;
if(b[i][j]=='L') c[11]++;
if(b[i][j]=='M') c[12]++;
if(b[i][j]=='N') c[13]++;
if(b[i][j]=='O') c[14]++;
if(b[i][j]=='P') c[15]++;
if(b[i][j]=='Q') c[16]++;
if(b[i][j]=='R') c[17]++;
if(b[i][j]=='S') c[18]++;
if(b[i][j]=='T') c[19]++;
if(b[i][j]=='U') c[20]++;
if(b[i][j]=='V') c[21]++;
if(b[i][j]=='W') c[22]++;
if(b[i][j]=='X') c[23]++;
if(b[i][j]=='Y') c[24]++;
if(b[i][j]=='Z') c[25]++;
}
}
for(i=0;i<26;i++)
{ temp=0;
for(j=0;j<26;j++)
{
if(c[i]>=c[j])
{
temp++;
}
}
if(temp==26) {max=i;break;}
}
w='A'+i;
printf("%c\n",w);
printf("%d\n",c[i]);
for(i=0;i<m;i++)
{
for(j=0;j<strlen(b[i]);j++)
{
if(b[i][j]==w) {printf("%s\n",a[i]);break;}
}
}
} |
2 | 881 | struct student
{
int num;
char name[20];
struct student* next;
};
struct student*creat(int n)
{
struct student*p1,*p2,*head;
int i;
p1=p2=(struct student*)malloc(len);
head=NULL;
i=0;
while(i<n)
{
scanf("%d %s",&p1->num, p1->name);
i=i+1;
if(i==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(len);
}
p2->next=NULL;
return head;
}
void main()
{
int i;
struct student *head,*p;
int n;
scanf("%d",&n);
head=creat(n);
p=head;
int a[26];
for (i=0; i<26; i++)
{
a[i]=0;
}
while (p!=NULL)
{
for (i=0;i<20;i++)
{
a[(int)p->name[i]-'A']++;
}
p = p->next;
}
int number, max = 0;
for (i=0; i<26; i++)
{
if (a[i] > max)
{
max = a[i];
number = i;
}
}
printf ("%c\n", 'A'+number);
printf ("%d\n", max);
p = head;
while (p!=NULL)
{
for (i=0;i<20;i++)
{
if (p->name[i] == 'A'+number)
break;
}
if (p->name[i] == 'A'+number)
printf ("%d\n", p->num);
p = p->next;
}
}
|
2 | 882 | struct book
{
int mark;
char name[26];
};
int main()
{
int m,h,i,j,k,max,length;
int t[26];
char a;
scanf("%d",&m);
struct book book[1000];
for(i=0;i<m;i++)
{
scanf("%d%s",&book[i].mark,book[i].name);
}
for(i=0;i<26;i++)
{
a='A'+i;
t[i]=0;
for(j=0;j<m;j++)
{
length=strlen(book[i].name);
for(h=0;h<26;h++)
if(a==book[j].name[h])
{
t[i]++;
}
}
}
max=0;
for(i=0;i<26;i++)
{
if(t[i]>max)
{
max=t[i];
k=i;
}
}
a='A'+k;
printf("%c\n%d\n",a,t[k]);
for(i=0;i<m;i++)
{
length=strlen(book[i].name);
for(j=0;j<26;j++)
{
if('A'+k==book[i].name[j])
printf("%d\n",book[i].mark);
}
}
return 0;
}
|
2 | 883 | 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 | 884 |
int main(int argc, char* argv[])
{
int n;
scanf("%d",&n);
struct{
int a;
char s[26];
}zuozhe[1000];
int i, k;
for(i=0;i<n;i++){
scanf("%d %s",&zuozhe[i].a, zuozhe[i].s);
}
int c[26]={0}, d;
for(i=0;i<n;i++){
d=strlen(zuozhe[i].s);
for(k=0;k<d;k++){
c[zuozhe[i].s[k]-65]++;
}
}
int f;
for(i=1;i<26;i++){
if(c[i]>c[0]){
f=i;
d=c[i];
c[i]=c[0];
c[0]=d;
}
}
printf("%c\n%d\n",f+65, c[0]);
for(i=0;i<n;i++){
d=strlen(zuozhe[i].s);
for(k=0;k<d;k++){
if(zuozhe[i].s[k]==f+65)
printf("%d\n",zuozhe[i].a);
}
}
return 0;
} |
2 | 885 |
int main()
{
int n;
int i, j;
int book_number[26];
int max = 0;
int max_n;
int author_len;
struct data
{
int number;
char author[27];
}input[1000];
scanf("%d", &n);
for(j = 0; j <= 25; j++)
book_number[j] = 0;
for(i = 0; i <= n - 1; i++)
{
scanf("%d %s", &input[i].number, input[i].author);
author_len = strlen(input[i].author);
for(j = 0; j <= author_len - 1; j++)
book_number[input[i].author[j] - 'A']++;
}
for(j = 0; j <= 25; j++)
{
if(book_number[j] > max)
{
max = book_number[j];
max_n = j;
}
}
printf("%c\n%d\n", max_n + 'A', max);
for(i = 0; i <= n - 1; i++)
{
author_len = strlen(input[i].author);
for(j = 0; j <= author_len - 1; j++)
{
if(input[i].author[j] == max_n + 'A')
{
printf("%d\n", input[i].number);
break;
}
}
}
return 0;
}
|
2 | 886 | struct author
{
int num;
char aut[27];
}a[999];
void main()
{
void search(struct author b[],int n,char marker);
int m ,i,times[30]={0};
int length=0,j;
int max=0,flag=9;
char chac;
scanf("%d",&m);
// printf("%d",m);
for(i=0;i<m;i++)
{
scanf("%d %s",&a[i].num,&a[i].aut);
// printf("%d %s",a[i].num,a[i].aut);
length=strlen(a[i].aut);
for(j=0;j<length;j++)
{
chac=a[i].aut[j];
times[chac-'A']++;
}
}
for(i=0;i<26;i++)
{
if(max<times[i])
{
max=times[i];
flag=i;
}
}
printf("%c\n%d\n",(char)(flag+'A'),max);
search(a,m,(char)(flag+'A'));
}
void search(struct author b[],int n,char marker)
{
int i,j;
for (i=0;i<n;i++)
{
for(j=0;j<strlen(b[i].aut);j++)
{
if(b[i].aut[j]==marker)
printf("%d\n",b[i].num);
}
}
}
|
2 | 887 | struct book
{
int num;
char name[20];
struct book *next;
};
int i,j,n,t,number[100],m;
struct book *creat(void)
{
struct book *p1,*p2,*head;
p1=p2=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
head=NULL;
for(i=1;i<m;i++)
{
if(i==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct book *)malloc(LEN);
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p2=p1;
p2->next=NULL;
return(head);
}
void main()
{
scanf("%d",&m);
struct book *creat(void);
struct book *head,*p;
int a[26]={0},max,maxindex=0;
head=p=creat();
char *pointer;
do
{
for(pointer=p->name;*pointer!='\0';pointer++)
{
for(i=0;i<26;i++)
{
if(*pointer==65+i)
a[i]++;
}
}
p=p->next;
}while(p!=NULL);
max=a[0];
for(i=1;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
maxindex=i;
}
}
printf("%c\n%d\n",65+maxindex,a[maxindex]);
p=head;
do
{
for(pointer=p->name;*pointer!='\0';pointer++)
{
if(*pointer==65+maxindex)
printf("%d\n",p->num);
}
p=p->next;
}while(p!=NULL);
} |
2 | 888 | 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 | 889 | struct
{
int no;
char wr[26];
}book[999];
struct
{
char name;
int num;
int book[999];
}a[26];
int main()
{
int n,m,t,k,d;
int all=0;
for (t=0;t<26;t++)
{
a[t].name='A'+t;
a[t].num=0;
}
scanf("%d",&m);
for (t=0;t<m;t++)
{
scanf("%d %s",&book[t].no,book[t].wr);
}
for (t=0;t<m;t++)
{
k=strlen(book[t].wr);
for(n=0;n<k;n++)
{
for(d=0;d<26;d++)
{
if (a[d].name==book[t].wr[n])
{
a[d].book[a[d].num]=book[t].no;
a[d].num++;
break;
}
}
}
}
k=0;
for (t=0;t<26;t++)
{
if (k<a[t].num)
k=a[t].num;
}
for (t=0;;t++)
{
if (k==a[t].num)
{
printf("%c",a[t].name);
printf("\n%d",a[t].num);
for (d=0;d<a[t].num;d++)
printf("\n%d",a[t].book[d]);
break;
}
}
} |
2 | 890 | struct book
{
int num;
char name[27];
struct book *next;
};
struct book *creat(int n)
{
struct book *head,*p1,*p2;
int m=0;
head=p1=p2=NULL;
p1=p2=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
while(1)
{
m+=1;
if(m>=n)break;
if(m==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct book *)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->name);
}
p2->next=p1;
p2=p1;
p2->next=NULL;
return(head);
}
void main()
{
struct book *head,*p;
char maxchar;
int m,i=0,max=0,a[26]={0};
scanf("%d",&m);
head=creat(m);
for(p=head;p!=NULL;p=p->next)
{
//printf("%d,%s\n",p->num,p->name);
for(i=0;p->name[i]!='\0';i++)
{
int c=p->name[i]-'A';
a[c]++;
}
}
for(i=0;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
maxchar='A'+i;
}
}
printf("%c\n%d\n",maxchar,max);
for(p=head;p!=NULL;p=p->next)
for(i=0;p->name[i]!='\0';i++)
{
if(p->name[i]==maxchar)
{
printf("%d\n",p->num);
break;
}
}
}
|
2 | 891 | 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 | 892 | int main()
{
int n,a[999],i,k[27]={0},j,t,m;
char b[999][27];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&a[i],b[i]);
for(j=0;b[i][j];j++)
k[b[i][j]-65]++;
}
t=k[0];m=0;
for(j=0;j<26;j++)
{
if(k[j]>t) {t=k[j];m=j;}
}
printf("%c\n%d\n",m+65,t);
for(i=0;i<n;i++)
{
for(j=0;b[i][j];j++)
{
if(b[i][j]==m+65)
{
printf("%d\n",a[i]);
break;
}
}
}
return 0;
}
|
2 | 893 | void main()
{
struct book{
int num;
char str[30];
}bk[1000]={0};
int i,j,m,n,sum[100]={0},number[1000]={0},result,max=0;
char temp='A';
scanf("%d",&m);
for(i=0;i<m;i++)
scanf("%d %s",&bk[i].num,&bk[i].str);
for(i=65;i<=90;i++){
for(j=0;j<m;j++){
for(n=0;n<26;n++)
if(bk[j].str[n]==i)
sum[i]++;
}
}
for(j=0;j<26;j++){
if(sum[j+65]>max){
max=sum[j+65];
temp=j+65;
result=j+65;
}
}
for(i=0;i<m;i++){
for(n=0;n<30;n++)
if(bk[i].str[n]==temp){
number[i]=bk[i].num;
break;
}
}
printf("%c\n%d\n",temp,sum[result]);
for(i=0;i<m;i++)
if(number[i]!=0)
printf("%d\n",number[i]);
}
|
2 | 894 | int main()
{
struct fy{
int x;
char y[26];
int s[26];
struct fy *z;
}sl[1000],*p;
int n,i,j,b[26]={0};
char a[100];
p=&sl[0];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %s",&sl[i].x,sl[i].y);
for(j=0;j<strlen(sl[i].y);j++)
{
sl[i].s[sl[i].y[j]-'A']=1;
b[sl[i].y[j]-'A']++;
}
sl[i].z=&sl[i+1];
}
sl[n-1].z=NULL;
for(i=0;i<26;i++)
{
for(j=0;j<26;j++)
if(b[i]<b[j])
break;
if(j==26)
{
j=i;
break;
}
}
printf("%c\n%d\n",i+'A',b[j]);
while(p!=NULL)
{
if(p->s[i]==1)
printf("%d\n",p->x);
p=p->z;
}
return 0;
} |
2 | 895 |
int main()
{
int maxc=0,i,j,n,a[1000],c;
char maxp,b[1000][27],p;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&a[i],b[i]);
}
for (p='A';p<='Z';p++)
{
c=0;
for(i=0;i<n;i++)
{
for(j=0;;j++)
{
if(b[i][j]=='\0') break;
if(b[i][j]==p)
{
c++;
}
}
}
if(c>maxc)
{
maxc=c;
maxp=p;
}
}
printf("%c\n",maxp);
printf("%d\n",maxc);
for(i=0;i<n;i++)
{
for(j=0;;j++)
{
if(b[i][j]=='\0') break;
if(b[i][j]==maxp)
{
printf("%d\n",a[i]);
}
}
}
return 0;
}
|
2 | 896 | struct book
{
int no;
char author[26];
}ji[1000];
main()
{
int n,i,j,len,a[26][1000],e,b[26]={0},max=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%s",&ji[i].no,ji[i].author);
len=strlen(ji[i].author);
for(j=0;j<len;j++)
{
e=ji[i].author[j];
e=e-65;
a[e][b[e]]=ji[i].no;
b[e]=b[e]+1;
}
}
for(i=0;i<26;i++)
if(b[max]<b[i])
max=i;
printf("%c\n%d\n",max+65,b[max]);
for(i=0;i<b[max];i++)
printf("%d\n",a[max][i]);
return 0;
} |
2 | 897 |
int main()
{int m, i, j, b[999], n[26], t[2]={0}, x=0;
char a[999][26], au;
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&b[i],a[i]);}
for(i=0;i<m;i++)
{
for(j=0;j<(int)strlen(a[i]);j++)
{n[(int)a[i][j]-65]++;}
}
for(i=0;i<26;i++)
{
if(t[0]<n[i])
{t[0]=n[i],t[1]=i;}
}
au=t[1]+65;
printf("%c\n%d\n",au,t[0]);
for(i=0;i<m;i++)
{
x=0,j=0;
while(j<(int)strlen(a[i])&&x==0)
{
if(a[i][j]==t[1]+65)
{printf("%d\n",b[i]),x++;}
else
{j++;}
}
}
return 0;
} |
2 | 898 | struct A
{
char num[1000];
char B[27];
};
void main()
{
int n,i,a,k,t;
int sb[27]={0};
int sb2[27]={0};
char x;
scanf("%d",&n);
struct A book[999]={0};
for (i=0;i<n;i++)
{
scanf("%s%s",book[i].num,book[i].B);
}
for(i=0;i<n;i++)
{
for(k=0; ;k++)
{
a=book[i].B[k];
if (book[i].B[k]<='Z'&&book[i].B[k]>='A')
{
sb[a-64]++;
}
else break;
}
}
for(i=1;i<=26;i++)
{
sb2[i]=sb[i];
}
for (i=1;i<26;i++)
{
if(sb[i]>sb[i+1])
{
a=sb[i];
sb[i]=sb[i+1];
sb[i+1]=a;
}
}
for(i=1;i<=26;i++)
{
if (sb2[i]==sb[26])
{
t=i;
}
}
x='A'+t-1;
printf("%c\n%d\n",x,sb[26]);
for(i=0;i<n;i++)
{
for(k=0; ;k++)
{
if(book[i].B[k]=='\0')break;
else if (book[i].B[k]==x)
printf("%s\n",book[i].num);
}
}
}
|
2 | 899 | struct book
{
int num;
char auth[26];
struct book *next;
};
struct book *creat(int m)
{
int i=0;
struct book *head,*p1,*p2;
if(i==0)
{
p1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->auth);
head=p1;
p2=p1;
p1->next=NULL;
i++;
}
while(i<m)
{
p1=(struct book*)malloc(sizeof(struct book));
scanf("%d %s",&p1->num,p1->auth);
p2->next=p1;
p1->next=NULL;
p2=p1;
i++;
}
return (head);
}
int main()
{
int m,i,lenth;
int max=0,maxwh=27;
int count[26]={0};
struct book *head,*p;
scanf("%d",&m);
head=creat(m);
p=head;
while(p!=NULL)
{
lenth=strlen(p->auth);
for(i=0;i<lenth;i++)
count[(int)(p->auth)[i]-65]++;
p=p->next;
}
for(i=0;i<26;i++)
{
if(count[i]>max)
{
max=count[i];
maxwh=i;
}
}
printf("%c\n",maxwh+65);
printf("%d\n",max);
p=head;
while(p!=NULL)
{
lenth=strlen(p->auth);
for(i=0;i<lenth;i++)
{
if((int)(p->auth[i])==maxwh+65)
{
printf("%d\n",p->num);
break;
}
}
p=p->next;
}
return 0;
}
|