Advertisement
Guest User

G_ACM

a guest
Apr 26th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double s, d, n;
  8.     cin >> s >> d >> n;
  9.  
  10.     int x = 1;
  11.     double temp;
  12.  
  13.     if (d == 0) cout << "0\n";
  14.     else
  15.     {
  16.         for (int i = 1; i <= 100; i++)
  17.         {
  18.             temp = s;
  19.             for (int j = 0; j < n; j++)
  20.             {
  21.                 temp = temp + (temp * i * 0.01);
  22.             }
  23.             if (temp == (s + d)) cout << i << endl;
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement