Skip to content

Commit

Permalink
Create VAR-solutions#1.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisheks008 authored Oct 1, 2020
1 parent 3e0bcb2 commit ae751f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Project Euler - HackerRank/#1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

t=int(input())
def ar(x):
return x*(x+1);
for i in range(t):
n =int(input())
n -=1;
a=int(n/3);
b=int(n/5);
c=int(n/15);
print(int(int(3*ar(a) + 5*ar(b) - 15*ar(c))>>1));

0 comments on commit ae751f4

Please sign in to comment.