#CCBOTPBA0000008. Population Increase
Population Increase
Population Increase
Source: beecrowd
Version: Phuoc Hung OJ Extended
Problem Statement
Two cities start with populations PA < PB and annual percentage rates GA and GB. Every year update each city independently using floor(old population × (100+rate)/100). Find the first year when PA strictly exceeds PB. If it takes more than 100 years, print the century message.
Input
Four values PA PB GA GB on one line. Populations are integers; both growth rates have exactly one decimal digit (percent). There is no leading test-count value.
Output
Print <k> anos. for the first k ≤ 100 years, otherwise exactly Mais de 1 seculo.. Even for 1 year print anos..
Subtasks
-
Subtask 1 (20%):
100 ≤ PA < PB ≤ 1000; rates0.1..10.0and0.0 ≤ GB < GA, one decimal digit. -
Subtask 2 (30%):
100 ≤ PA < PB ≤ 100000; same rate bounds. -
Subtask 3 (50%):
100 ≤ PA < PB ≤ 1000000; same rate bounds.
Examples
Example 1
Input:
100 150 1.0 0.0
Output:
51 anos.
Explanation: The annual integer increase is applied every year; after 51 years A first exceeds B.
Example 2
Input:
100 101 10.0 0.0
Output:
1 anos.
Explanation: After one year A=110>B=101; keep the plural form anos..