Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- long long int N;
- long double G1, G2, PA, PB;
- long double ga, gb;
- long long int i = 0, ano = 0;
- std :: cin >> N;
- while (i < N)
- {
- std :: cin >> PA >> PB >> G1 >> G2;
- ano = 0;
- while ( PA < PB)
- {
- ga = G1 * (PA/100);
- gb = G2 * (PB/100);
- PA = PA + ga;
- PB = PB + gb;
- ano++;
- if (ano > 100)
- {
- break;
- }
- }
- if (ano <= 100)
- std :: cout << ano << " anos." << std :: endl;
- else
- std :: cout << "Mais de 1 seculo." << std :: endl;
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement