>>109

# ABCDEFGに対してなら
# BCDEFGAが一番勝率高い気がする
library(gtools)
n=7
k=2
perm=permutations(n,n)
Q=perm[1,]
np=nrow(perm)
p1st=numeric(np)
for(i in 1:np){
P=perm[i,]
tre=combn(n,k)
nt=ncol(tre)
re=numeric()
for(j in 1:nt){
re[j]=min(which(tre[1,j]==P),which(tre[2,j]==P))-
min(which(tre[1,j]==Q),which(tre[2,j]==Q))
}
p1st[i]=sum(re<0)
}
plot(p1st)
p1st[which.max(p1st)]
(p.max=which(p1st==15))
print(matrix(LETTERS[perm[p.max,]],ncol=7),quote=F)

#