题目描述
实验
样例
#include <iostream>
using namespace std;
int main()
{
int a, n;
char c;
scanf("%d", &n);
int sum = 0, C = 0, R = 0, F = 0;
while (n -- )
{
cin>>a>>c;
if(c=='C') C+=a;
if(c=='R') R+=a;
else if(c=='F') F+=a;
sum+=a;
}
double c2=(1.0*C/sum)*100;
double r=(1.0*R/sum)*100;
double f=(1.0*F/sum)*100;
printf("Total: %d animals\n", sum);
printf("Total coneys: %d\n", C);
printf("Total rats: %d\n", R);
printf("Total frogs: %d\n", F);
printf("Percentage of coneys: %.2lf %%\n", c2);
printf("Percentage of rats: %.2lf %%\n", r);
printf("Percentage of frogs: %.2lf %%\n", f);
return 0;
}
----------
### 算法1
##### (暴力枚举) $O(n^2)$
blablabla
#### 时间复杂度
#### 参考文献
#### C++ 代码
blablabla
----------
### 算法2
##### (暴力枚举) $O(n^2)$
blablabla
#### 时间复杂度
#### 参考文献
#### C++ 代码
blablabla
```