-
-
Save ArthurLoboLobo/a9ba3a4b5306e40b2ea9d2d05666ed37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int n, r, p; | |
cin >> n >> r >> p; | |
if(n >= p) { | |
cout << 0 << endl; | |
} | |
else { | |
int infectados_totais = n; | |
int infectados_novos = n; | |
for(int i = 1; i <= p; i++) { | |
infectados_totais+= infectados_novos*r; | |
infectados_novos = infectados_novos*r; | |
if(infectados_totais >= p) { | |
cout << i << endl; | |
return 0; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment