Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0089093

Browse files
authored
Solution
1 parent 6d288df commit 0089093

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the viralAdvertising function below.
10+
def viralAdvertising(n):
11+
shared =5
12+
cumulative=0
13+
for i in range(1,n+1):
14+
liked = shared//2
15+
cumulative+=liked
16+
shared = liked*3
17+
return cumulative
18+
19+
if __name__ == '__main__':
20+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
21+
22+
n = int(input())
23+
24+
result = viralAdvertising(n)
25+
26+
fptr.write(str(result) + '\n')
27+
28+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /