Result: Accepted
Time: 0ms
Memory: 1700kB
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
int main(){
int n;
cin>>n;
int *a = (int *)malloc(sizeof(int)*n);
int Ajianpan=-1,Ayouxi=-1,Akafei=-1;
int jianpan=0,youxi=0,kafei=0;
string jianpanname[200],youxiname[200],kafeiname[200];
int alljianpan=0,allyouxi=0,allkafei=0;
string name[200];
string num[200];
for(int i =0;i<n;++i){//n个人
cin>>a[i];
cin>>name[i];//信息
jianpan=0;youxi=0;kafei=0;
for(int j=0;j<a[i];++j){
cin>>num[j];
if(num[j][0]==num[j][1] && num[j][3]==num[j][4] && num[j][6]==num[j][7]){
++jianpan;
}
else if(num[j][0]>num[j][1] && num[j][1]>num[j][3] && num[j][3]>num[j][4] && num[j][4]>num[j][6] && num[j][6]>num[j][7]){
++youxi;
}
else {
++kafei;
}
}
if(jianpan>=Ajianpan){
if(jianpan>Ajianpan){Ajianpan = jianpan;alljianpan = 1;jianpanname[0] = name[i];}
else{
Ajianpan = jianpan;
++alljianpan;
jianpanname[alljianpan-1] = name[i];
}
}
if(youxi>=Ayouxi){
if(youxi>Ayouxi){Ayouxi = youxi;allyouxi=1;youxiname[0] = name[i];}
else{
Ayouxi = youxi;
++allyouxi;
youxiname[allyouxi-1] = name[i];
}
}
if(kafei >= Akafei){
if(kafei > Akafei){Akafei = kafei;allkafei=1;kafeiname[0] = name[i];}
else{
Akafei = kafei;
++allkafei;
kafeiname[allkafei-1] = name[i];
}
}
}
printf("If you want to have a keyboard, you should call: ");
for(int I=0;I<alljianpan-1;++I){cout<<jianpanname[I]<<", ";}
cout<<jianpanname[alljianpan-1]<<"."<<endl;
printf("If you want to order a Watchdog2, you should call: ");
for(int I=0;I<allyouxi-1;++I){cout<<youxiname[I]<<", ";}
cout<<youxiname[allyouxi-1]<<"."<<endl;
printf("If you want to have a cup of coffee with a girl, you should call: ");
for(int I=0;I<allkafei-1;++I){cout<<kafeiname[I]<<", ";}
cout<<kafeiname[allkafei-1]<<"."<<endl;
}