-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1094 Experiments.cpp
More file actions
35 lines (32 loc) · 877 Bytes
/
1094 Experiments.cpp
File metadata and controls
35 lines (32 loc) · 877 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
32
33
34
35
// Please Do not copy and submit these code without trying more than three times.
#include <iostream>
using namespace std;
int main()
{
int n , a , c = 0 , r = 0 ,s = 0 , t = 0;
double d;
char w;
cin >> n;
for(int i= 0 ; i < n ; i++){
cin >> a >> w;
if(w == 'C'){
c+=a;
}
else if(w == 'R'){
r+=a;
}
else if(w == 'S'){
s+=a;
}
t = t+a;
}
cout << "Total: " << t << " cobaias" << endl;
cout << "Total de coelhos: " << c << endl;
cout << "Total de ratos: " << r << endl;
cout << "Total de sapos: " << s << endl;
d = 100.0/t;
printf("Percentual de coelhos: %.2lf %\n" , d*c);
printf("Percentual de ratos: %.2lf %\n" , d*r);
printf("Percentual de sapos: %.2lf %\n" , d*s);
return 0;
}