include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int main()
{
int N;
cin >> N;
int n_C, n_F, n_R;
float n_all;
n_C = n_F = n_R = 0;
for (int i=1; i<=N; i++)
{
char animal;
int n_animal;
cin >> n_animal >> animal;
switch (animal)
{
case ‘C’:
n_C += n_animal;
break;
case ‘F’:
n_F += n_animal;
break;
case ‘R’:
n_R += n_animal;
break;
}
}
n_all = n_C + n_F + n_R;
float r_C = n_C/n_all, r_F=n_F/n_all, r_R=n_R/n_all;
cout << “Total: ” << n_all << ” animals” << endl;
cout << “Total coneys: ” << n_C << endl;
cout << “Total rats: ” << n_R <<endl;
cout << “Total frogs: ” << n_F << endl;
printf(“Percentage of coneys: %.2f %%\n”, r_C100);
printf(“Percentage of rats: %.2f %%\n”, r_R100);
printf(“Percentage of frogs: %.2f %%\n”, r_F*100);
return 0;
}