-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1149.py
50 lines (38 loc) · 860 Bytes
/
1149.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'''
#https://github.com/joy1954islam/uri-problem-solution-in-python/blob/master/problem%201149%20Summing%20Consecutive%20Integers.py
#Take multiple inputs
lista = list(map(int, input().split()))
n1 = 'I'
n2 = 0
soma = 0
# For elements in list
#First iteration n1 = i
#keep looping until
for i in lista:
if (n1 == 'I'):
n1 = i
print(f"i = {n1}")
else:
if (i > 0):
n2 = i
print(f"n2 = {n2}")
break
print("New loop")
for i in range(n2):
soma += n1
print(f"sum = {soma}")
n1 += 1
print(f"n1 = {n1}")
print(f"{soma}")
'''
sample = list(map(int, input().split()))
A = sample[0]
N = sample[-1]
total = [A]
for i in range(1,N):
A += 1
total.append(A)
#print(A)
#print(total)
result = sum(total)
print(result)