-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBC1160.cpp
More file actions
32 lines (27 loc) · 712 Bytes
/
BC1160.cpp
File metadata and controls
32 lines (27 loc) · 712 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
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
while (n)
{
int A_population, B_population, year = 0;
float A_growth_rate, B_growth_rate;
cin >> A_population >> B_population >> A_growth_rate >> B_growth_rate;
while (A_population <= B_population)
{
A_population += (A_population * A_growth_rate) / 100;
B_population += (B_population * B_growth_rate) / 100;
++year;
if (year > 100)
break;
}
if (year <= 100)
cout << year << " anos." << endl;
else
cout << "Mais de 1 seculo." << endl;
n--;
}
return 0;
}