solved hackerrank viral advertising

Signed-off-by: ayham <altffour@protonmail.com>
This commit is contained in:
ayham 2021-05-09 19:54:29 +03:00
parent f1f1f52eb2
commit 011e4c0458
No known key found for this signature in database
GPG Key ID: 81D38F7122AFCC94
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int recipients = 5;
int total_likes = 0;
while (n--) {
total_likes += floor(recipients/2);
recipients = floor(recipients/2)*3;
}
cout << total_likes <<endl;
return 0;
}