We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #1: Multiples of 3 and 5
Project Euler #1: Multiples of 3 and 5
Sort by
recency
|
1454 Discussions
|
Please Login in order to post a comment
handle long only:
t = int(input().strip()) for a0 in range(t): n = int(input().strip()) c=0 for p in range(n): if p%3==0 or p%5==0 and p%15!=0: c=c+p print(c) why time limit exceed in this code
def sum_multiples(k, n): m = (n - 1) // k return k * m * (m + 1) // 2
if name == 'main': t = int(input().strip())
It runs well but when I try sending code, it times out in test 2 and 3.
KOTLIN Code