蒟蒻瑟瑟发抖……………………………………………………
include < cstdio >
include < iostream >
include < iomanip >
using namespace std;
int main(){
int a,b[100],tt=0,tc=0,tr=0,tf=0;
char c[100];
double rr,rc,rf;
scanf(“%d”,&a);
for(int i=0;i<a;i++){
scanf(“%d %c”,&b[i],&c[i]);
tt+=b[i];
if(c[i]==’C’){
tc+=b[i];
}
else if(c[i]==’R’){
tr+=b[i];
}
else{
tf+=b[i];
}
}
rr=tr100.00/double(tt);
rf=tf100.00/double(tt);
rc=tc*100.00/double(tt);
cout<<”Total: “<<tt<<” animals”<<endl;
cout<<”Total coneys: “<<tc<<endl;
cout<<”Total rats: “<<tr<<endl;
cout<<”Total frogs: “<<tf<<endl;
cout<<”Percentage of coneys: “;
printf(“%.2f”,rc);
cout<<” %”<<endl;
cout<<”Percentage of rats: “;
printf(“%.2f”,rr);
cout<<” %”<<endl;
cout<<”Percentage of frogs: “;
printf(“%.2f”,rf);
cout<<” %”<<endl;
return 0;
}