Advertisement
CMatchelo

Untitled

Nov 28th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. long long int N;
  6. long double G1, G2, PA, PB;
  7. long double ga, gb;
  8. long long int i = 0, ano = 0;
  9.  
  10. std :: cin >> N;
  11.  
  12. while (i < N)
  13. {
  14. std :: cin >> PA >> PB >> G1 >> G2;
  15. ano = 0;
  16. while ( PA < PB)
  17. {
  18. ga = G1 * (PA/100);
  19. gb = G2 * (PB/100);
  20.  
  21. PA = PA + ga;
  22. PB = PB + gb;
  23.  
  24. ano++;
  25.  
  26. if (ano > 100)
  27. {
  28. break;
  29. }
  30. }
  31. if (ano <= 100)
  32. std :: cout << ano << " anos." << std :: endl;
  33. else
  34. std :: cout << "Mais de 1 seculo." << std :: endl;
  35.  
  36. i++;
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement