嗯,我承认我是迟到了...而且还不是batch的...
是python的:- #09/4/4/12
- def make_list(num):
- n,k,b,c = num,0,num/2,num**2
- listx = []
- for x in xrange(n):
- listx.append([])
- for _x in xrange(n):
- listx[x].append(False)
- for _x in xrange(c):
- if((_x+1)==1):
- listx[k] = 1
-
- elif((_x+1)%n==1):
- k = k+1
- if(k>n-1):
- k = k-n
- listx[k] = _x+1
- else:
- k = k+2
- b = b+1
- if(b>n-1):
- b = 0
- if(k>n-1):
- k = k-n
- listx[k] = _x+1
- for y in xrange(n):
- print(listx[y])
-
- def start():
- print("Input a number:")
- x = input()
- if(x%2==0):
- print("Wrong.")
- else:
- make_list(x)
-
- if __name__ == "__main__":
- start()
复制代码
[ 本帖最后由 xxx 于 2009-4-12 14:05 编辑 ] |