Subject:
Code:
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the viralAdvertising function below.
def viralAdvertising(n):
shared = 5
liked = 2
cumulative = 2
for i in range(n-1):
shared = (shared // 2) * 3
liked = shared // 2
cumulative = cumulative + liked
return cumulative
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
result = viralAdvertising(n)
fptr.write(str(result) + '\n')
fptr.close()
If you feel good, please like and follow the message~
Thank you for joining us~