Skip to content

Instantly share code, notes, and snippets.

@varequan
Created March 3, 2018 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varequan/4ab0e47cc1bfc4dc6297f2d7ea83127c to your computer and use it in GitHub Desktop.
Save varequan/4ab0e47cc1bfc4dc6297f2d7ea83127c to your computer and use it in GitHub Desktop.
刑侦科推理试题程序作答
#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
i=0
option=['o','a','b','c','d']
for a in xrange(1,5):
for b in xrange(1,5):
for c in xrange(1,5):
for d in xrange(1,5):
for e in xrange(1,5):
for f in xrange(1,5):
for g in xrange(1,5):
for h in xrange(1,5):
for i in xrange(1,5):
for j in xrange(1,5):
count=[0,0,0,0]
count[a-1]+=1
count[b-1]+=1
count[c-1]+=1
count[d-1]+=1
count[e-1]+=1
count[f-1]+=1
count[g-1]+=1
count[h-1]+=1
count[i-1]+=1
count[j-1]+=1
minOption = count.index(min(count))+1
minNum = min(count)
maxNum = max(count)
if g == minOption :
if (maxNum-minNum==3 and j==1) or (maxNum-minNum==2 and j==2) or (maxNum-minNum==4 and j==3 ) or (maxNum-minNum==1 and j==4):
if (d==1 and a==e) or (d==2 and b==g) or (d==3 and a==i) or ( d==4 and f==j):
if (d==b and d==f and b==f and c==1) or (b==d and c==b and c==d and c==2) or (f==d and c==f and c==d and c==3) or (f==b and c==f and c==b and c==4):
if (e==1 and e==h and b==3) or (e==2 and e==d and b==4) or (e==3 and e==i and b==1) or (e==4 and e==g and b==2):
if (h==b and h==d and b==d and f==1) or (h==a and h==f and a==f and f==2) or (h==c and h==j and c==j and f==3) or (h==e and h==i and e==i and f==4):
if a == f and ((e!=f and i==1) or (e!=j and i==2) or (e!=b and i==3) or (e!=i and i==4)):
print(option[a]+','+option[b]+','+option[c]+','+option[d]+','+option[e]+','+option[f]+','+option[g]+','+option[h]+','+option[i]+','+option[j])
elif a != f and ((e==f and i==1) or (e==j and i==2) or (e==b and i==3) or (e==i and i==4)):
print(option[a]+','+option[b]+','+option[c]+','+option[d]+','+option[e]+','+option[f]+','+option[g]+','+option[h]+','+option[i]+','+option[j])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment