-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1094.cpp
More file actions
31 lines (27 loc) · 796 Bytes
/
1094.cpp
File metadata and controls
31 lines (27 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
int main(){
double n ,total = 0, tc = 0, tr = 0, ts = 0;
scanf("%lf",&n);
for(int i = 0;i < n; i++){
char a;
double b;
scanf("%lf",&b);
cin >> a;
total += b;
if(a == 'C')
tc += b;
else if(a == 'R')
tr += b;
else
ts += b;
}
printf("Total: %.0lf cobaias\n",total);
printf("Total de coelhos: %.0lf\n",tc);
printf("Total de ratos: %.0lf\n",tr);
printf("Total de sapos: %.0lf\n",ts);
printf("Percentual de coelhos: %.2lf %%\n",(tc*100)/total);
printf("Percentual de ratos: %.2lf %%\n",(tr*100)/total);
printf("Percentual de sapos: %.2lf %%\n",(ts*100)/total);
return 0;
}