AcWing 718. 实验
原题链接
困难
作者:
Owen_1
,
2020-07-26 22:06:06
,
所有人可见
,
阅读 399
#include <cstdio>
int main()
{
int n;
scanf("%d", &n);
int a;
char b;
int G = 0, D = 0, E = 0, H = 0;
for (int i = 0; i < n; i ++)
{
scanf("%d %c", &a, &b);
if (b == 'C') G += a;
else if (b == 'R') D += a;
else if (b == 'F') E += a;
H += a;
}
printf("Total: %d animals\nTotal coneys: %d\nTotal rats: %d\nTotal frogs: %d\nPercentage of coneys: %.2lf %\nPercentage of rats: %.2lf %\nPercentage of frogs: %.2lf %\n", H, G, D, E, ((double)G / H)*100, ((double)D / H)*100, ((double)E / H)*100);
return 0;
}