Merge pull request #295 from bp274/master

Modernize Python 2 code to work for Python 3
This commit is contained in:
Harshil 2018-04-17 00:52:00 +05:30 committed by GitHub
commit 5832340ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,10 @@ except NameError:
raw_input = input # Python 3
n = int(raw_input().strip())
sum = 0
terms = (n-1)/3
sum+= ((terms)*(6+(terms-1)*3))/2 #sum of an A.P.
terms = (n-1)/5
sum+= ((terms)*(10+(terms-1)*5))/2
terms = (n-1)/15
sum-= ((terms)*(30+(terms-1)*15))/2
terms = (n-1)//3
sum+= ((terms)*(6+(terms-1)*3))//2 #sum of an A.P.
terms = (n-1)//5
sum+= ((terms)*(10+(terms-1)*5))//2
terms = (n-1)//15
sum-= ((terms)*(30+(terms-1)*15))//2
print(sum)