-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha471.py
More file actions
27 lines (26 loc) · 710 Bytes
/
a471.py
File metadata and controls
27 lines (26 loc) · 710 Bytes
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
import math
while True:
try:
n = int(input())
total = 0
factors1 = []
factors2 = []
s = 0
for i in range(2, int(math.sqrt(2*n))+1):
if 2*n%i == 0:
factors1.append(i)
factors2.append((2*n)//i)
factors1.reverse()
factors2.reverse()
for i in range(len(factors1)):
p = factors2[i]
q = factors1[i]
a = (p+q-1)/2
b = (p-q+1)/2
if a %1 ==0 and b%1 == 0:
print(int(b),"-",int(a), sep = "")
s = 1
if s == 0:
print("No Solution...")
except:
break