-
Notifications
You must be signed in to change notification settings - Fork 0
/
uri_beg_prblm1094.cpp
42 lines (31 loc) · 997 Bytes
/
uri_beg_prblm1094.cpp
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
36
37
38
39
40
41
42
#include <iostream>
#include <stdio.h>
using namespace std;
//beginer prblm-1094
//solved :)
int main(){
int n;
int q;
char t;
int total = 0;
int coelho = 0;
int sapo = 0;
int rato = 0;
cin >> n;
for(int i = 0; i < n; i++){
cin >> q;
cin >> t;
total += q;
if(t == 'C') coelho += q;
if(t == 'S') sapo += q;
if(t == 'R') rato += q;
}
cout << "Total: " << total << " cobaias\n";
cout << "Total de coelhos: " << coelho << "\n";
cout << "Total de ratos: " << rato << "\n";
cout << "Total de sapos: " << sapo << "\n";
printf("Percentual de coelhos: %.2f %\n", ((float)coelho/(float)total)*100.00);
printf("Percentual de ratos: %.2f %\n", ((float)rato/(float)total)*100.00);
printf("Percentual de sapos: %.2f %\n", ((float)sapo/(float)total)*100.00);
return 0;
}