-
-
Save manrysh/1f7f49ba86c53ea13562fae985da8cbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k = 15 | |
n = 9838 | |
f0 = open('a.txt','r') | |
f = open('c.txt','w') | |
s = [line.strip('\n') for line in f0.readlines()] | |
def sum3(ss,nn): | |
oo = [[ss[i]+ss[j] for j in range(i)] for i in range(nn)] | |
for i in range(nn): | |
probe = 0 | |
string = '' | |
m=ss[i]*(-1) | |
new = oo[0:i]+oo[i+1:] | |
for j in new: | |
test = [] | |
tt=[] | |
if m in j: | |
probe = 1 | |
tt=[i+1,oo.index(j)+1,j.index(m)+1] | |
tt.sort() | |
for item in tt: | |
string+= str(item)+' ' | |
return string | |
if probe == 0: | |
return -1 | |
for i in range(k): | |
s[i] = map(int,s[i].split()) | |
f.write(str(sum3(s[i],n))+'\n') | |
f0.close() | |
f.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment