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