`
lylegend13
  • 浏览: 82828 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

长度为N的数组的编号的全排列

360 
阅读更多
// A2.java

public class A2 {

	private final static int N = 6;

	public static void main(String[] args) {

		// 第一维:1到N
		// 第二维:方向,0向左,1向右
		int a[][] = new int[N][2];
		createArray(a);

		System.out.println("1:");
		printArray(a);
		System.out.println("\n");

		int i = 2;
		while (maxActive(a) != -1) {
			System.out.println(i + ":");
			exec(a);
			printArray(a);
			System.out.println("\n");
			i++;
		}
	}

	// 变换
	public static void exec(int a[][]) {
		int active = maxActive(a);
		int temp = a[active][0];

		// 交换最大活跨跃数和相邻值
		if (a[active][1] == 0) {
			exchangeValue(a, active - 1, active);
		} else {
			exchangeValue(a, active, active + 1);
		}

		// 交换数值更大的方向
		for (int i = 0; i < N; i++) {
			if (a[i][0] > temp) {
				a[i][1] ^= 1;
			}
		}
	}

	// 找出最大活跃数
	public static int maxActive(int a[][]) {
		int active = -1;
		for (int i = 0; i < N; i++) {
			// 0
			if (i == 0) {
				if (a[i][1] == 1 && a[i][0] > a[i + 1][0]) {
					if (active == -1) {
						active = i;
					} else if (a[i][0] > a[active][0]) {
						active = i;
					}
				}
			}// N-1
			else if (i == N - 1) {
				if (a[i][1] == 0 && a[i][0] > a[i - 1][0]) {
					if (active == -1) {
						active = i;
					} else if (a[i][0] > a[active][0]) {
						active = i;
					}
				}
			}// 其它
			else {
				if ((a[i][1] == 1 && a[i][0] > a[i + 1][0]) || (a[i][1] == 0 && a[i][0] > a[i - 1][0])) {
					if (active == -1) {
						active = i;
					} else if (a[i][0] > a[active][0]) {
						active = i;
					}
				}
			}
		}
		return active;
	}

	// N个数全排列的个数
	public static int count(int n) {
		if (n == 1) {
			return 1;
		} else {
			return n * count(n - 1);
		}
	}

	// 交换值
	public static void exchangeValue(int a[][], int n1, int n2) {
		int temp[] = a[n1];
		a[n1] = a[n2];
		a[n2] = temp;
	}

	// 生成数组
	public static void createArray(int a[][]) {
		for (int i = 0; i < a.length; i++) {
			a[i][0] = i + 1;
		}
	}

	// 显示数组
	public static void printArray(int a[][]) {
		for (int i = 0; i < N; i++) {
			System.out.print(a[i][0] + " ");
		}
		System.out.println();
		for (int i = 0; i < N; i++) {
			System.out.print(a[i][1] + " ");
		}
	}
}

 

运行结果:

 

1:
1 2 3 4 5 6
0 0 0 0 0 0

2:
1 2 3 4 6 5
0 0 0 0 0 0

3:
1 2 3 6 4 5
0 0 0 0 0 0

4:
1 2 6 3 4 5
0 0 0 0 0 0

5:
1 6 2 3 4 5
0 0 0 0 0 0

6:
6 1 2 3 4 5
0 0 0 0 0 0

7:
6 1 2 3 5 4
1 0 0 0 0 0

8:
1 6 2 3 5 4
0 1 0 0 0 0

9:
1 2 6 3 5 4
0 0 1 0 0 0

10:
1 2 3 6 5 4
0 0 0 1 0 0

11:
1 2 3 5 6 4
0 0 0 0 1 0

12:
1 2 3 5 4 6
0 0 0 0 0 1

13:
1 2 5 3 4 6
0 0 0 0 0 0

14:
1 2 5 3 6 4
0 0 0 0 0 0

15:
1 2 5 6 3 4
0 0 0 0 0 0

16:
1 2 6 5 3 4
0 0 0 0 0 0

17:
1 6 2 5 3 4
0 0 0 0 0 0

18:
6 1 2 5 3 4
0 0 0 0 0 0

19:
6 1 5 2 3 4
1 0 0 0 0 0

20:
1 6 5 2 3 4
0 1 0 0 0 0

21:
1 5 6 2 3 4
0 0 1 0 0 0

22:
1 5 2 6 3 4
0 0 0 1 0 0

23:
1 5 2 3 6 4
0 0 0 0 1 0

24:
1 5 2 3 4 6
0 0 0 0 0 1

25:
5 1 2 3 4 6
0 0 0 0 0 0

26:
5 1 2 3 6 4
0 0 0 0 0 0

27:
5 1 2 6 3 4
0 0 0 0 0 0

28:
5 1 6 2 3 4
0 0 0 0 0 0

29:
5 6 1 2 3 4
0 0 0 0 0 0

30:
6 5 1 2 3 4
0 0 0 0 0 0

31:
6 5 1 2 4 3
1 1 0 0 0 0

32:
5 6 1 2 4 3
1 1 0 0 0 0

33:
5 1 6 2 4 3
1 0 1 0 0 0

34:
5 1 2 6 4 3
1 0 0 1 0 0

35:
5 1 2 4 6 3
1 0 0 0 1 0

36:
5 1 2 4 3 6
1 0 0 0 0 1

37:
1 5 2 4 3 6
0 1 0 0 0 0

38:
1 5 2 4 6 3
0 1 0 0 0 0

39:
1 5 2 6 4 3
0 1 0 0 0 0

40:
1 5 6 2 4 3
0 1 0 0 0 0

41:
1 6 5 2 4 3
0 0 1 0 0 0

42:
6 1 5 2 4 3
0 0 1 0 0 0

43:
6 1 2 5 4 3
1 0 0 1 0 0

44:
1 6 2 5 4 3
0 1 0 1 0 0

45:
1 2 6 5 4 3
0 0 1 1 0 0

46:
1 2 5 6 4 3
0 0 1 1 0 0

47:
1 2 5 4 6 3
0 0 1 0 1 0

48:
1 2 5 4 3 6
0 0 1 0 0 1

49:
1 2 4 5 3 6
0 0 0 1 0 0

50:
1 2 4 5 6 3
0 0 0 1 0 0

51:
1 2 4 6 5 3
0 0 0 0 1 0

52:
1 2 6 4 5 3
0 0 0 0 1 0

53:
1 6 2 4 5 3
0 0 0 0 1 0

54:
6 1 2 4 5 3
0 0 0 0 1 0

55:
6 1 2 4 3 5
1 0 0 0 0 1

56:
1 6 2 4 3 5
0 1 0 0 0 1

57:
1 2 6 4 3 5
0 0 1 0 0 1

58:
1 2 4 6 3 5
0 0 0 1 0 1

59:
1 2 4 3 6 5
0 0 0 0 1 1

60:
1 2 4 3 5 6
0 0 0 0 1 1

61:
1 4 2 3 5 6
0 0 0 0 0 0

62:
1 4 2 3 6 5
0 0 0 0 0 0

63:
1 4 2 6 3 5
0 0 0 0 0 0

64:
1 4 6 2 3 5
0 0 0 0 0 0

65:
1 6 4 2 3 5
0 0 0 0 0 0

66:
6 1 4 2 3 5
0 0 0 0 0 0

67:
6 1 4 2 5 3
1 0 0 0 0 0

68:
1 6 4 2 5 3
0 1 0 0 0 0

69:
1 4 6 2 5 3
0 0 1 0 0 0

70:
1 4 2 6 5 3
0 0 0 1 0 0

71:
1 4 2 5 6 3
0 0 0 0 1 0

72:
1 4 2 5 3 6
0 0 0 0 0 1

73:
1 4 5 2 3 6
0 0 0 0 0 0

74:
1 4 5 2 6 3
0 0 0 0 0 0

75:
1 4 5 6 2 3
0 0 0 0 0 0

76:
1 4 6 5 2 3
0 0 0 0 0 0

77:
1 6 4 5 2 3
0 0 0 0 0 0

78:
6 1 4 5 2 3
0 0 0 0 0 0

79:
6 1 5 4 2 3
1 0 0 0 0 0

80:
1 6 5 4 2 3
0 1 0 0 0 0

81:
1 5 6 4 2 3
0 0 1 0 0 0

82:
1 5 4 6 2 3
0 0 0 1 0 0

83:
1 5 4 2 6 3
0 0 0 0 1 0

84:
1 5 4 2 3 6
0 0 0 0 0 1

85:
5 1 4 2 3 6
0 0 0 0 0 0

86:
5 1 4 2 6 3
0 0 0 0 0 0

87:
5 1 4 6 2 3
0 0 0 0 0 0

88:
5 1 6 4 2 3
0 0 0 0 0 0

89:
5 6 1 4 2 3
0 0 0 0 0 0

90:
6 5 1 4 2 3
0 0 0 0 0 0

91:
6 5 4 1 2 3
1 1 0 0 0 0

92:
5 6 4 1 2 3
1 1 0 0 0 0

93:
5 4 6 1 2 3
1 0 1 0 0 0

94:
5 4 1 6 2 3
1 0 0 1 0 0

95:
5 4 1 2 6 3
1 0 0 0 1 0

96:
5 4 1 2 3 6
1 0 0 0 0 1

97:
4 5 1 2 3 6
0 1 0 0 0 0

98:
4 5 1 2 6 3
0 1 0 0 0 0

99:
4 5 1 6 2 3
0 1 0 0 0 0

100:
4 5 6 1 2 3
0 1 0 0 0 0

101:
4 6 5 1 2 3
0 0 1 0 0 0

102:
6 4 5 1 2 3
0 0 1 0 0 0

103:
6 4 1 5 2 3
1 0 0 1 0 0

104:
4 6 1 5 2 3
0 1 0 1 0 0

105:
4 1 6 5 2 3
0 0 1 1 0 0

106:
4 1 5 6 2 3
0 0 1 1 0 0

107:
4 1 5 2 6 3
0 0 1 0 1 0

108:
4 1 5 2 3 6
0 0 1 0 0 1

109:
4 1 2 5 3 6
0 0 0 1 0 0

110:
4 1 2 5 6 3
0 0 0 1 0 0

111:
4 1 2 6 5 3
0 0 0 0 1 0

112:
4 1 6 2 5 3
0 0 0 0 1 0

113:
4 6 1 2 5 3
0 0 0 0 1 0

114:
6 4 1 2 5 3
0 0 0 0 1 0

115:
6 4 1 2 3 5
1 0 0 0 0 1

116:
4 6 1 2 3 5
0 1 0 0 0 1

117:
4 1 6 2 3 5
0 0 1 0 0 1

118:
4 1 2 6 3 5
0 0 0 1 0 1

119:
4 1 2 3 6 5
0 0 0 0 1 1

120:
4 1 2 3 5 6
0 0 0 0 1 1

121:
4 1 3 2 5 6
1 0 0 0 0 0

122:
4 1 3 2 6 5
1 0 0 0 0 0

123:
4 1 3 6 2 5
1 0 0 0 0 0

124:
4 1 6 3 2 5
1 0 0 0 0 0

125:
4 6 1 3 2 5
1 0 0 0 0 0

126:
6 4 1 3 2 5
0 1 0 0 0 0

127:
6 4 1 3 5 2
1 1 0 0 0 0

128:
4 6 1 3 5 2
1 1 0 0 0 0

129:
4 1 6 3 5 2
1 0 1 0 0 0

130:
4 1 3 6 5 2
1 0 0 1 0 0

131:
4 1 3 5 6 2
1 0 0 0 1 0

132:
4 1 3 5 2 6
1 0 0 0 0 1

133:
4 1 5 3 2 6
1 0 0 0 0 0

134:
4 1 5 3 6 2
1 0 0 0 0 0

135:
4 1 5 6 3 2
1 0 0 0 0 0

136:
4 1 6 5 3 2
1 0 0 0 0 0

137:
4 6 1 5 3 2
1 0 0 0 0 0

138:
6 4 1 5 3 2
0 1 0 0 0 0

139:
6 4 5 1 3 2
1 1 0 0 0 0

140:
4 6 5 1 3 2
1 1 0 0 0 0

141:
4 5 6 1 3 2
1 0 1 0 0 0

142:
4 5 1 6 3 2
1 0 0 1 0 0

143:
4 5 1 3 6 2
1 0 0 0 1 0

144:
4 5 1 3 2 6
1 0 0 0 0 1

145:
5 4 1 3 2 6
0 1 0 0 0 0

146:
5 4 1 3 6 2
0 1 0 0 0 0

147:
5 4 1 6 3 2
0 1 0 0 0 0

148:
5 4 6 1 3 2
0 1 0 0 0 0

149:
5 6 4 1 3 2
0 0 1 0 0 0

150:
6 5 4 1 3 2
0 0 1 0 0 0

151:
6 5 1 4 3 2
1 1 0 1 0 0

152:
5 6 1 4 3 2
1 1 0 1 0 0

153:
5 1 6 4 3 2
1 0 1 1 0 0

154:
5 1 4 6 3 2
1 0 1 1 0 0

155:
5 1 4 3 6 2
1 0 1 0 1 0

156:
5 1 4 3 2 6
1 0 1 0 0 1

157:
1 5 4 3 2 6
0 1 1 0 0 0

158:
1 5 4 3 6 2
0 1 1 0 0 0

159:
1 5 4 6 3 2
0 1 1 0 0 0

160:
1 5 6 4 3 2
0 1 0 1 0 0

161:
1 6 5 4 3 2
0 0 1 1 0 0

162:
6 1 5 4 3 2
0 0 1 1 0 0

163:
6 1 4 5 3 2
1 0 1 1 0 0

164:
1 6 4 5 3 2
0 1 1 1 0 0

165:
1 4 6 5 3 2
0 1 1 1 0 0

166:
1 4 5 6 3 2
0 1 1 1 0 0

167:
1 4 5 3 6 2
0 1 1 0 1 0

168:
1 4 5 3 2 6
0 1 1 0 0 1

169:
1 4 3 5 2 6
0 1 0 1 0 0

170:
1 4 3 5 6 2
0 1 0 1 0 0

171:
1 4 3 6 5 2
0 1 0 0 1 0

172:
1 4 6 3 5 2
0 1 0 0 1 0

173:
1 6 4 3 5 2
0 0 1 0 1 0

174:
6 1 4 3 5 2
0 0 1 0 1 0

175:
6 1 4 3 2 5
1 0 1 0 0 1

176:
1 6 4 3 2 5
0 1 1 0 0 1

177:
1 4 6 3 2 5
0 1 1 0 0 1

178:
1 4 3 6 2 5
0 1 0 1 0 1

179:
1 4 3 2 6 5
0 1 0 0 1 1

180:
1 4 3 2 5 6
0 1 0 0 1 1

181:
1 3 4 2 5 6
0 0 1 0 0 0

182:
1 3 4 2 6 5
0 0 1 0 0 0

183:
1 3 4 6 2 5
0 0 1 0 0 0

184:
1 3 6 4 2 5
0 0 0 1 0 0

185:
1 6 3 4 2 5
0 0 0 1 0 0

186:
6 1 3 4 2 5
0 0 0 1 0 0

187:
6 1 3 4 5 2
1 0 0 1 0 0

188:
1 6 3 4 5 2
0 1 0 1 0 0

189:
1 3 6 4 5 2
0 0 1 1 0 0

190:
1 3 4 6 5 2
0 0 1 1 0 0

191:
1 3 4 5 6 2
0 0 1 0 1 0

192:
1 3 4 5 2 6
0 0 1 0 0 1

193:
1 3 5 4 2 6
0 0 0 1 0 0

194:
1 3 5 4 6 2
0 0 0 1 0 0

195:
1 3 5 6 4 2
0 0 0 0 1 0

196:
1 3 6 5 4 2
0 0 0 0 1 0

197:
1 6 3 5 4 2
0 0 0 0 1 0

198:
6 1 3 5 4 2
0 0 0 0 1 0

199:
6 1 5 3 4 2
1 0 0 0 1 0

200:
1 6 5 3 4 2
0 1 0 0 1 0

201:
1 5 6 3 4 2
0 0 1 0 1 0

202:
1 5 3 6 4 2
0 0 0 1 1 0

203:
1 5 3 4 6 2
0 0 0 1 1 0

204:
1 5 3 4 2 6
0 0 0 1 0 1

205:
5 1 3 4 2 6
0 0 0 1 0 0

206:
5 1 3 4 6 2
0 0 0 1 0 0

207:
5 1 3 6 4 2
0 0 0 0 1 0

208:
5 1 6 3 4 2
0 0 0 0 1 0

209:
5 6 1 3 4 2
0 0 0 0 1 0

210:
6 5 1 3 4 2
0 0 0 0 1 0

211:
6 5 1 3 2 4
1 1 0 0 0 1

212:
5 6 1 3 2 4
1 1 0 0 0 1

213:
5 1 6 3 2 4
1 0 1 0 0 1

214:
5 1 3 6 2 4
1 0 0 1 0 1

215:
5 1 3 2 6 4
1 0 0 0 1 1

216:
5 1 3 2 4 6
1 0 0 0 1 1

217:
1 5 3 2 4 6
0 1 0 0 1 0

218:
1 5 3 2 6 4
0 1 0 0 0 1

219:
1 5 3 6 2 4
0 1 0 0 0 1

220:
1 5 6 3 2 4
0 1 0 0 0 1

221:
1 6 5 3 2 4
0 0 1 0 0 1

222:
6 1 5 3 2 4
0 0 1 0 0 1

223:
6 1 3 5 2 4
1 0 0 1 0 1

224:
1 6 3 5 2 4
0 1 0 1 0 1

225:
1 3 6 5 2 4
0 0 1 1 0 1

226:
1 3 5 6 2 4
0 0 1 1 0 1

227:
1 3 5 2 6 4
0 0 1 0 1 1

228:
1 3 5 2 4 6
0 0 1 0 1 1

229:
1 3 2 5 4 6
0 0 0 1 1 0

230:
1 3 2 5 6 4
0 0 0 1 0 1

231:
1 3 2 6 5 4
0 0 0 0 1 1

232:
1 3 6 2 5 4
0 0 0 0 1 1

233:
1 6 3 2 5 4
0 0 0 0 1 1

234:
6 1 3 2 5 4
0 0 0 0 1 1

235:
6 1 3 2 4 5
1 0 0 0 1 1

236:
1 6 3 2 4 5
0 1 0 0 1 1

237:
1 3 6 2 4 5
0 0 1 0 1 1

238:
1 3 2 6 4 5
0 0 0 1 1 1

239:
1 3 2 4 6 5
0 0 0 1 1 1

240:
1 3 2 4 5 6
0 0 0 1 1 1

241:
3 1 2 4 5 6
0 0 0 0 0 0

242:
3 1 2 4 6 5
0 0 0 0 0 0

243:
3 1 2 6 4 5
0 0 0 0 0 0

244:
3 1 6 2 4 5
0 0 0 0 0 0

245:
3 6 1 2 4 5
0 0 0 0 0 0

246:
6 3 1 2 4 5
0 0 0 0 0 0

247:
6 3 1 2 5 4
1 0 0 0 0 0

248:
3 6 1 2 5 4
0 1 0 0 0 0

249:
3 1 6 2 5 4
0 0 1 0 0 0

250:
3 1 2 6 5 4
0 0 0 1 0 0

251:
3 1 2 5 6 4
0 0 0 0 1 0

252:
3 1 2 5 4 6
0 0 0 0 0 1

253:
3 1 5 2 4 6
0 0 0 0 0 0

254:
3 1 5 2 6 4
0 0 0 0 0 0

255:
3 1 5 6 2 4
0 0 0 0 0 0

256:
3 1 6 5 2 4
0 0 0 0 0 0

257:
3 6 1 5 2 4
0 0 0 0 0 0

258:
6 3 1 5 2 4
0 0 0 0 0 0

259:
6 3 5 1 2 4
1 0 0 0 0 0

260:
3 6 5 1 2 4
0 1 0 0 0 0

261:
3 5 6 1 2 4
0 0 1 0 0 0

262:
3 5 1 6 2 4
0 0 0 1 0 0

263:
3 5 1 2 6 4
0 0 0 0 1 0

264:
3 5 1 2 4 6
0 0 0 0 0 1

265:
5 3 1 2 4 6
0 0 0 0 0 0

266:
5 3 1 2 6 4
0 0 0 0 0 0

267:
5 3 1 6 2 4
0 0 0 0 0 0

268:
5 3 6 1 2 4
0 0 0 0 0 0

269:
5 6 3 1 2 4
0 0 0 0 0 0

270:
6 5 3 1 2 4
0 0 0 0 0 0

271:
6 5 3 1 4 2
1 1 0 0 0 0

272:
5 6 3 1 4 2
1 1 0 0 0 0

273:
5 3 6 1 4 2
1 0 1 0 0 0

274:
5 3 1 6 4 2
1 0 0 1 0 0

275:
5 3 1 4 6 2
1 0 0 0 1 0

276:
5 3 1 4 2 6
1 0 0 0 0 1

277:
3 5 1 4 2 6
0 1 0 0 0 0

278:
3 5 1 4 6 2
0 1 0 0 0 0

279:
3 5 1 6 4 2
0 1 0 0 0 0

280:
3 5 6 1 4 2
0 1 0 0 0 0

281:
3 6 5 1 4 2
0 0 1 0 0 0

282:
6 3 5 1 4 2
0 0 1 0 0 0

283:
6 3 1 5 4 2
1 0 0 1 0 0

284:
3 6 1 5 4 2
0 1 0 1 0 0

285:
3 1 6 5 4 2
0 0 1 1 0 0

286:
3 1 5 6 4 2
0 0 1 1 0 0

287:
3 1 5 4 6 2
0 0 1 0 1 0

288:
3 1 5 4 2 6
0 0 1 0 0 1

289:
3 1 4 5 2 6
0 0 0 1 0 0

290:
3 1 4 5 6 2
0 0 0 1 0 0

291:
3 1 4 6 5 2
0 0 0 0 1 0

292:
3 1 6 4 5 2
0 0 0 0 1 0

293:
3 6 1 4 5 2
0 0 0 0 1 0

294:
6 3 1 4 5 2
0 0 0 0 1 0

295:
6 3 1 4 2 5
1 0 0 0 0 1

296:
3 6 1 4 2 5
0 1 0 0 0 1

297:
3 1 6 4 2 5
0 0 1 0 0 1

298:
3 1 4 6 2 5
0 0 0 1 0 1

299:
3 1 4 2 6 5
0 0 0 0 1 1

300:
3 1 4 2 5 6
0 0 0 0 1 1

301:
3 4 1 2 5 6
0 0 0 0 0 0

302:
3 4 1 2 6 5
0 0 0 0 0 0

303:
3 4 1 6 2 5
0 0 0 0 0 0

304:
3 4 6 1 2 5
0 0 0 0 0 0

305:
3 6 4 1 2 5
0 0 0 0 0 0

306:
6 3 4 1 2 5
0 0 0 0 0 0

307:
6 3 4 1 5 2
1 0 0 0 0 0

308:
3 6 4 1 5 2
0 1 0 0 0 0

309:
3 4 6 1 5 2
0 0 1 0 0 0

310:
3 4 1 6 5 2
0 0 0 1 0 0

311:
3 4 1 5 6 2
0 0 0 0 1 0

312:
3 4 1 5 2 6
0 0 0 0 0 1

313:
3 4 5 1 2 6
0 0 0 0 0 0

314:
3 4 5 1 6 2
0 0 0 0 0 0

315:
3 4 5 6 1 2
0 0 0 0 0 0

316:
3 4 6 5 1 2
0 0 0 0 0 0

317:
3 6 4 5 1 2
0 0 0 0 0 0

318:
6 3 4 5 1 2
0 0 0 0 0 0

319:
6 3 5 4 1 2
1 0 0 0 0 0

320:
3 6 5 4 1 2
0 1 0 0 0 0

321:
3 5 6 4 1 2
0 0 1 0 0 0

322:
3 5 4 6 1 2
0 0 0 1 0 0

323:
3 5 4 1 6 2
0 0 0 0 1 0

324:
3 5 4 1 2 6
0 0 0 0 0 1

325:
5 3 4 1 2 6
0 0 0 0 0 0

326:
5 3 4 1 6 2
0 0 0 0 0 0

327:
5 3 4 6 1 2
0 0 0 0 0 0

328:
5 3 6 4 1 2
0 0 0 0 0 0

329:
5 6 3 4 1 2
0 0 0 0 0 0

330:
6 5 3 4 1 2
0 0 0 0 0 0

331:
6 5 4 3 1 2
1 1 0 0 0 0

332:
5 6 4 3 1 2
1 1 0 0 0 0

333:
5 4 6 3 1 2
1 0 1 0 0 0

334:
5 4 3 6 1 2
1 0 0 1 0 0

335:
5 4 3 1 6 2
1 0 0 0 1 0

336:
5 4 3 1 2 6
1 0 0 0 0 1

337:
4 5 3 1 2 6
0 1 0 0 0 0

338:
4 5 3 1 6 2
0 1 0 0 0 0

339:
4 5 3 6 1 2
0 1 0 0 0 0

340:
4 5 6 3 1 2
0 1 0 0 0 0

341:
4 6 5 3 1 2
0 0 1 0 0 0

342:
6 4 5 3 1 2
0 0 1 0 0 0

343:
6 4 3 5 1 2
1 0 0 1 0 0

344:
4 6 3 5 1 2
0 1 0 1 0 0

345:
4 3 6 5 1 2
0 0 1 1 0 0

346:
4 3 5 6 1 2
0 0 1 1 0 0

347:
4 3 5 1 6 2
0 0 1 0 1 0

348:
4 3 5 1 2 6
0 0 1 0 0 1

349:
4 3 1 5 2 6
0 0 0 1 0 0

350:
4 3 1 5 6 2
0 0 0 1 0 0

351:
4 3 1 6 5 2
0 0 0 0 1 0

352:
4 3 6 1 5 2
0 0 0 0 1 0

353:
4 6 3 1 5 2
0 0 0 0 1 0

354:
6 4 3 1 5 2
0 0 0 0 1 0

355:
6 4 3 1 2 5
1 0 0 0 0 1

356:
4 6 3 1 2 5
0 1 0 0 0 1

357:
4 3 6 1 2 5
0 0 1 0 0 1

358:
4 3 1 6 2 5
0 0 0 1 0 1

359:
4 3 1 2 6 5
0 0 0 0 1 1

360:
4 3 1 2 5 6
0 0 0 0 1 1

361:
4 3 2 1 5 6
1 1 0 0 0 0

362:
4 3 2 1 6 5
1 1 0 0 0 0

363:
4 3 2 6 1 5
1 1 0 0 0 0

364:
4 3 6 2 1 5
1 1 0 0 0 0

365:
4 6 3 2 1 5
1 0 1 0 0 0

366:
6 4 3 2 1 5
0 1 1 0 0 0

367:
6 4 3 2 5 1
1 1 1 0 0 0

368:
4 6 3 2 5 1
1 1 1 0 0 0

369:
4 3 6 2 5 1
1 1 1 0 0 0

370:
4 3 2 6 5 1
1 1 0 1 0 0

371:
4 3 2 5 6 1
1 1 0 0 1 0

372:
4 3 2 5 1 6
1 1 0 0 0 1

373:
4 3 5 2 1 6
1 1 0 0 0 0

374:
4 3 5 2 6 1
1 1 0 0 0 0

375:
4 3 5 6 2 1
1 1 0 0 0 0

376:
4 3 6 5 2 1
1 1 0 0 0 0

377:
4 6 3 5 2 1
1 0 1 0 0 0

378:
6 4 3 5 2 1
0 1 1 0 0 0

379:
6 4 5 3 2 1
1 1 0 1 0 0

380:
4 6 5 3 2 1
1 1 0 1 0 0

381:
4 5 6 3 2 1
1 0 1 1 0 0

382:
4 5 3 6 2 1
1 0 1 1 0 0

383:
4 5 3 2 6 1
1 0 1 0 1 0

384:
4 5 3 2 1 6
1 0 1 0 0 1

385:
5 4 3 2 1 6
0 1 1 0 0 0

386:
5 4 3 2 6 1
0 1 1 0 0 0

387:
5 4 3 6 2 1
0 1 1 0 0 0

388:
5 4 6 3 2 1
0 1 0 1 0 0

389:
5 6 4 3 2 1
0 0 1 1 0 0

390:
6 5 4 3 2 1
0 0 1 1 0 0

391:
6 5 3 4 2 1
1 1 1 1 0 0

392:
5 6 3 4 2 1
1 1 1 1 0 0

393:
5 3 6 4 2 1
1 1 1 1 0 0

394:
5 3 4 6 2 1
1 1 1 1 0 0

395:
5 3 4 2 6 1
1 1 1 0 1 0

396:
5 3 4 2 1 6
1 1 1 0 0 1

397:
3 5 4 2 1 6
1 1 1 0 0 0

398:
3 5 4 2 6 1
1 1 1 0 0 0

399:
3 5 4 6 2 1
1 1 1 0 0 0

400:
3 5 6 4 2 1
1 1 0 1 0 0

401:
3 6 5 4 2 1
1 0 1 1 0 0

402:
6 3 5 4 2 1
0 1 1 1 0 0

403:
6 3 4 5 2 1
1 1 1 1 0 0

404:
3 6 4 5 2 1
1 1 1 1 0 0

405:
3 4 6 5 2 1
1 1 1 1 0 0

406:
3 4 5 6 2 1
1 1 1 1 0 0

407:
3 4 5 2 6 1
1 1 1 0 1 0

408:
3 4 5 2 1 6
1 1 1 0 0 1

409:
3 4 2 5 1 6
1 1 0 1 0 0

410:
3 4 2 5 6 1
1 1 0 1 0 0

411:
3 4 2 6 5 1
1 1 0 0 1 0

412:
3 4 6 2 5 1
1 1 0 0 1 0

413:
3 6 4 2 5 1
1 0 1 0 1 0

414:
6 3 4 2 5 1
0 1 1 0 1 0

415:
6 3 4 2 1 5
1 1 1 0 0 1

416:
3 6 4 2 1 5
1 1 1 0 0 1

417:
3 4 6 2 1 5
1 1 1 0 0 1

418:
3 4 2 6 1 5
1 1 0 1 0 1

419:
3 4 2 1 6 5
1 1 0 0 1 1

420:
3 4 2 1 5 6
1 1 0 0 1 1

421:
3 2 4 1 5 6
1 0 1 0 0 0

422:
3 2 4 1 6 5
1 0 1 0 0 0

423:
3 2 4 6 1 5
1 0 1 0 0 0

424:
3 2 6 4 1 5
1 0 0 1 0 0

425:
3 6 2 4 1 5
1 0 0 1 0 0

426:
6 3 2 4 1 5
0 1 0 1 0 0

427:
6 3 2 4 5 1
1 1 0 1 0 0

428:
3 6 2 4 5 1
1 1 0 1 0 0

429:
3 2 6 4 5 1
1 0 1 1 0 0

430:
3 2 4 6 5 1
1 0 1 1 0 0

431:
3 2 4 5 6 1
1 0 1 0 1 0

432:
3 2 4 5 1 6
1 0 1 0 0 1

433:
3 2 5 4 1 6
1 0 0 1 0 0

434:
3 2 5 4 6 1
1 0 0 1 0 0

435:
3 2 5 6 4 1
1 0 0 0 1 0

436:
3 2 6 5 4 1
1 0 0 0 1 0

437:
3 6 2 5 4 1
1 0 0 0 1 0

438:
6 3 2 5 4 1
0 1 0 0 1 0

439:
6 3 5 2 4 1
1 1 0 0 1 0

440:
3 6 5 2 4 1
1 1 0 0 1 0

441:
3 5 6 2 4 1
1 0 1 0 1 0

442:
3 5 2 6 4 1
1 0 0 1 1 0

443:
3 5 2 4 6 1
1 0 0 1 1 0

444:
3 5 2 4 1 6
1 0 0 1 0 1

445:
5 3 2 4 1 6
0 1 0 1 0 0

446:
5 3 2 4 6 1
0 1 0 1 0 0

447:
5 3 2 6 4 1
0 1 0 0 1 0

448:
5 3 6 2 4 1
0 1 0 0 1 0

449:
5 6 3 2 4 1
0 0 1 0 1 0

450:
6 5 3 2 4 1
0 0 1 0 1 0

451:
6 5 3 2 1 4
1 1 1 0 0 1

452:
5 6 3 2 1 4
1 1 1 0 0 1

453:
5 3 6 2 1 4
1 1 1 0 0 1

454:
5 3 2 6 1 4
1 1 0 1 0 1

455:
5 3 2 1 6 4
1 1 0 0 1 1

456:
5 3 2 1 4 6
1 1 0 0 1 1

457:
3 5 2 1 4 6
1 1 0 0 1 0

458:
3 5 2 1 6 4
1 1 0 0 0 1

459:
3 5 2 6 1 4
1 1 0 0 0 1

460:
3 5 6 2 1 4
1 1 0 0 0 1

461:
3 6 5 2 1 4
1 0 1 0 0 1

462:
6 3 5 2 1 4
0 1 1 0 0 1

463:
6 3 2 5 1 4
1 1 0 1 0 1

464:
3 6 2 5 1 4
1 1 0 1 0 1

465:
3 2 6 5 1 4
1 0 1 1 0 1

466:
3 2 5 6 1 4
1 0 1 1 0 1

467:
3 2 5 1 6 4
1 0 1 0 1 1

468:
3 2 5 1 4 6
1 0 1 0 1 1

469:
3 2 1 5 4 6
1 0 0 1 1 0

470:
3 2 1 5 6 4
1 0 0 1 0 1

471:
3 2 1 6 5 4
1 0 0 0 1 1

472:
3 2 6 1 5 4
1 0 0 0 1 1

473:
3 6 2 1 5 4
1 0 0 0 1 1

474:
6 3 2 1 5 4
0 1 0 0 1 1

475:
6 3 2 1 4 5
1 1 0 0 1 1

476:
3 6 2 1 4 5
1 1 0 0 1 1

477:
3 2 6 1 4 5
1 0 1 0 1 1

478:
3 2 1 6 4 5
1 0 0 1 1 1

479:
3 2 1 4 6 5
1 0 0 1 1 1

480:
3 2 1 4 5 6
1 0 0 1 1 1

481:
2 3 1 4 5 6
0 1 0 0 0 0

482:
2 3 1 4 6 5
0 1 0 0 0 0

483:
2 3 1 6 4 5
0 1 0 0 0 0

484:
2 3 6 1 4 5
0 1 0 0 0 0

485:
2 6 3 1 4 5
0 0 1 0 0 0

486:
6 2 3 1 4 5
0 0 1 0 0 0

487:
6 2 3 1 5 4
1 0 1 0 0 0

488:
2 6 3 1 5 4
0 1 1 0 0 0

489:
2 3 6 1 5 4
0 1 1 0 0 0

490:
2 3 1 6 5 4
0 1 0 1 0 0

491:
2 3 1 5 6 4
0 1 0 0 1 0

492:
2 3 1 5 4 6
0 1 0 0 0 1

493:
2 3 5 1 4 6
0 1 0 0 0 0

494:
2 3 5 1 6 4
0 1 0 0 0 0

495:
2 3 5 6 1 4
0 1 0 0 0 0

496:
2 3 6 5 1 4
0 1 0 0 0 0

497:
2 6 3 5 1 4
0 0 1 0 0 0

498:
6 2 3 5 1 4
0 0 1 0 0 0

499:
6 2 5 3 1 4
1 0 0 1 0 0

500:
2 6 5 3 1 4
0 1 0 1 0 0

501:
2 5 6 3 1 4
0 0 1 1 0 0

502:
2 5 3 6 1 4
0 0 1 1 0 0

503:
2 5 3 1 6 4
0 0 1 0 1 0

504:
2 5 3 1 4 6
0 0 1 0 0 1

505:
5 2 3 1 4 6
0 0 1 0 0 0

506:
5 2 3 1 6 4
0 0 1 0 0 0

507:
5 2 3 6 1 4
0 0 1 0 0 0

508:
5 2 6 3 1 4
0 0 0 1 0 0

509:
5 6 2 3 1 4
0 0 0 1 0 0

510:
6 5 2 3 1 4
0 0 0 1 0 0

511:
6 5 2 3 4 1
1 1 0 1 0 0

512:
5 6 2 3 4 1
1 1 0 1 0 0

513:
5 2 6 3 4 1
1 0 1 1 0 0

514:
5 2 3 6 4 1
1 0 1 1 0 0

515:
5 2 3 4 6 1
1 0 1 0 1 0

516:
5 2 3 4 1 6
1 0 1 0 0 1

517:
2 5 3 4 1 6
0 1 1 0 0 0

518:
2 5 3 4 6 1
0 1 1 0 0 0

519:
2 5 3 6 4 1
0 1 1 0 0 0

520:
2 5 6 3 4 1
0 1 0 1 0 0

521:
2 6 5 3 4 1
0 0 1 1 0 0

522:
6 2 5 3 4 1
0 0 1 1 0 0

523:
6 2 3 5 4 1
1 0 1 1 0 0

524:
2 6 3 5 4 1
0 1 1 1 0 0

525:
2 3 6 5 4 1
0 1 1 1 0 0

526:
2 3 5 6 4 1
0 1 1 1 0 0

527:
2 3 5 4 6 1
0 1 1 0 1 0

528:
2 3 5 4 1 6
0 1 1 0 0 1

529:
2 3 4 5 1 6
0 1 0 1 0 0

530:
2 3 4 5 6 1
0 1 0 1 0 0

531:
2 3 4 6 5 1
0 1 0 0 1 0

532:
2 3 6 4 5 1
0 1 0 0 1 0

533:
2 6 3 4 5 1
0 0 1 0 1 0

534:
6 2 3 4 5 1
0 0 1 0 1 0

535:
6 2 3 4 1 5
1 0 1 0 0 1

536:
2 6 3 4 1 5
0 1 1 0 0 1

537:
2 3 6 4 1 5
0 1 1 0 0 1

538:
2 3 4 6 1 5
0 1 0 1 0 1

539:
2 3 4 1 6 5
0 1 0 0 1 1

540:
2 3 4 1 5 6
0 1 0 0 1 1

541:
2 4 3 1 5 6
0 0 1 0 0 0

542:
2 4 3 1 6 5
0 0 1 0 0 0

543:
2 4 3 6 1 5
0 0 1 0 0 0

544:
2 4 6 3 1 5
0 0 0 1 0 0

545:
2 6 4 3 1 5
0 0 0 1 0 0

546:
6 2 4 3 1 5
0 0 0 1 0 0

547:
6 2 4 3 5 1
1 0 0 1 0 0

548:
2 6 4 3 5 1
0 1 0 1 0 0

549:
2 4 6 3 5 1
0 0 1 1 0 0

550:
2 4 3 6 5 1
0 0 1 1 0 0

551:
2 4 3 5 6 1
0 0 1 0 1 0

552:
2 4 3 5 1 6
0 0 1 0 0 1

553:
2 4 5 3 1 6
0 0 0 1 0 0

554:
2 4 5 3 6 1
0 0 0 1 0 0

555:
2 4 5 6 3 1
0 0 0 0 1 0

556:
2 4 6 5 3 1
0 0 0 0 1 0

557:
2 6 4 5 3 1
0 0 0 0 1 0

558:
6 2 4 5 3 1
0 0 0 0 1 0

559:
6 2 5 4 3 1
1 0 0 0 1 0

560:
2 6 5 4 3 1
0 1 0 0 1 0

561:
2 5 6 4 3 1
0 0 1 0 1 0

562:
2 5 4 6 3 1
0 0 0 1 1 0

563:
2 5 4 3 6 1
0 0 0 1 1 0

564:
2 5 4 3 1 6
0 0 0 1 0 1

565:
5 2 4 3 1 6
0 0 0 1 0 0

566:
5 2 4 3 6 1
0 0 0 1 0 0

567:
5 2 4 6 3 1
0 0 0 0 1 0

568:
5 2 6 4 3 1
0 0 0 0 1 0

569:
5 6 2 4 3 1
0 0 0 0 1 0

570:
6 5 2 4 3 1
0 0 0 0 1 0

571:
6 5 4 2 3 1
1 1 0 0 1 0

572:
5 6 4 2 3 1
1 1 0 0 1 0

573:
5 4 6 2 3 1
1 0 1 0 1 0

574:
5 4 2 6 3 1
1 0 0 1 1 0

575:
5 4 2 3 6 1
1 0 0 1 1 0

576:
5 4 2 3 1 6
1 0 0 1 0 1

577:
4 5 2 3 1 6
0 1 0 1 0 0

578:
4 5 2 3 6 1
0 1 0 1 0 0

579:
4 5 2 6 3 1
0 1 0 0 1 0

580:
4 5 6 2 3 1
0 1 0 0 1 0

581:
4 6 5 2 3 1
0 0 1 0 1 0

582:
6 4 5 2 3 1
0 0 1 0 1 0

583:
6 4 2 5 3 1
1 0 0 1 1 0

584:
4 6 2 5 3 1
0 1 0 1 1 0

585:
4 2 6 5 3 1
0 0 1 1 1 0

586:
4 2 5 6 3 1
0 0 1 1 1 0

587:
4 2 5 3 6 1
0 0 1 1 1 0

588:
4 2 5 3 1 6
0 0 1 1 0 1

589:
4 2 3 5 1 6
0 0 1 1 0 0

590:
4 2 3 5 6 1
0 0 1 1 0 0

591:
4 2 3 6 5 1
0 0 1 0 1 0

592:
4 2 6 3 5 1
0 0 0 1 1 0

593:
4 6 2 3 5 1
0 0 0 1 1 0

594:
6 4 2 3 5 1
0 0 0 1 1 0

595:
6 4 2 3 1 5
1 0 0 1 0 1

596:
4 6 2 3 1 5
0 1 0 1 0 1

597:
4 2 6 3 1 5
0 0 1 1 0 1

598:
4 2 3 6 1 5
0 0 1 1 0 1

599:
4 2 3 1 6 5
0 0 1 0 1 1

600:
4 2 3 1 5 6
0 0 1 0 1 1

601:
4 2 1 3 5 6
1 0 0 1 0 0

602:
4 2 1 3 6 5
1 0 0 1 0 0

603:
4 2 1 6 3 5
1 0 0 0 1 0

604:
4 2 6 1 3 5
1 0 0 0 1 0

605:
4 6 2 1 3 5
1 0 0 0 1 0

606:
6 4 2 1 3 5
0 1 0 0 1 0

607:
6 4 2 1 5 3
1 1 0 0 0 1

608:
4 6 2 1 5 3
1 1 0 0 0 1

609:
4 2 6 1 5 3
1 0 1 0 0 1

610:
4 2 1 6 5 3
1 0 0 1 0 1

611:
4 2 1 5 6 3
1 0 0 0 1 1

612:
4 2 1 5 3 6
1 0 0 0 1 1

613:
4 2 5 1 3 6
1 0 0 0 1 0

614:
4 2 5 1 6 3
1 0 0 0 0 1

615:
4 2 5 6 1 3
1 0 0 0 0 1

616:
4 2 6 5 1 3
1 0 0 0 0 1

617:
4 6 2 5 1 3
1 0 0 0 0 1

618:
6 4 2 5 1 3
0 1 0 0 0 1

619:
6 4 5 2 1 3
1 1 0 0 0 1

620:
4 6 5 2 1 3
1 1 0 0 0 1

621:
4 5 6 2 1 3
1 0 1 0 0 1

622:
4 5 2 6 1 3
1 0 0 1 0 1

623:
4 5 2 1 6 3
1 0 0 0 1 1

624:
4 5 2 1 3 6
1 0 0 0 1 1

625:
5 4 2 1 3 6
0 1 0 0 1 0

626:
5 4 2 1 6 3
0 1 0 0 0 1

627:
5 4 2 6 1 3
0 1 0 0 0 1

628:
5 4 6 2 1 3
0 1 0 0 0 1

629:
5 6 4 2 1 3
0 0 1 0 0 1

630:
6 5 4 2 1 3
0 0 1 0 0 1

631:
6 5 2 4 1 3
1 1 0 1 0 1

632:
5 6 2 4 1 3
1 1 0 1 0 1

633:
5 2 6 4 1 3
1 0 1 1 0 1

634:
5 2 4 6 1 3
1 0 1 1 0 1

635:
5 2 4 1 6 3
1 0 1 0 1 1

636:
5 2 4 1 3 6
1 0 1 0 1 1

637:
2 5 4 1 3 6
0 1 1 0 1 0

638:
2 5 4 1 6 3
0 1 1 0 0 1

639:
2 5 4 6 1 3
0 1 1 0 0 1

640:
2 5 6 4 1 3
0 1 0 1 0 1

641:
2 6 5 4 1 3
0 0 1 1 0 1

642:
6 2 5 4 1 3
0 0 1 1 0 1

643:
6 2 4 5 1 3
1 0 1 1 0 1

644:
2 6 4 5 1 3
0 1 1 1 0 1

645:
2 4 6 5 1 3
0 1 1 1 0 1

646:
2 4 5 6 1 3
0 1 1 1 0 1

647:
2 4 5 1 6 3
0 1 1 0 1 1

648:
2 4 5 1 3 6
0 1 1 0 1 1

649:
2 4 1 5 3 6
0 1 0 1 1 0

650:
2 4 1 5 6 3
0 1 0 1 0 1

651:
2 4 1 6 5 3
0 1 0 0 1 1

652:
2 4 6 1 5 3
0 1 0 0 1 1

653:
2 6 4 1 5 3
0 0 1 0 1 1

654:
6 2 4 1 5 3
0 0 1 0 1 1

655:
6 2 4 1 3 5
1 0 1 0 1 1

656:
2 6 4 1 3 5
0 1 1 0 1 1

657:
2 4 6 1 3 5
0 1 1 0 1 1

658:
2 4 1 6 3 5
0 1 0 1 1 1

659:
2 4 1 3 6 5
0 1 0 1 1 1

660:
2 4 1 3 5 6
0 1 0 1 1 1

661:
2 1 4 3 5 6
0 0 1 1 0 0

662:
2 1 4 3 6 5
0 0 1 1 0 0

663:
2 1 4 6 3 5
0 0 1 0 1 0

664:
2 1 6 4 3 5
0 0 0 1 1 0

665:
2 6 1 4 3 5
0 0 0 1 1 0

666:
6 2 1 4 3 5
0 0 0 1 1 0

667:
6 2 1 4 5 3
1 0 0 1 0 1

668:
2 6 1 4 5 3
0 1 0 1 0 1

669:
2 1 6 4 5 3
0 0 1 1 0 1

670:
2 1 4 6 5 3
0 0 1 1 0 1

671:
2 1 4 5 6 3
0 0 1 0 1 1

672:
2 1 4 5 3 6
0 0 1 0 1 1

673:
2 1 5 4 3 6
0 0 0 1 1 0

674:
2 1 5 4 6 3
0 0 0 1 0 1

675:
2 1 5 6 4 3
0 0 0 0 1 1

676:
2 1 6 5 4 3
0 0 0 0 1 1

677:
2 6 1 5 4 3
0 0 0 0 1 1

678:
6 2 1 5 4 3
0 0 0 0 1 1

679:
6 2 5 1 4 3
1 0 0 0 1 1

680:
2 6 5 1 4 3
0 1 0 0 1 1

681:
2 5 6 1 4 3
0 0 1 0 1 1

682:
2 5 1 6 4 3
0 0 0 1 1 1

683:
2 5 1 4 6 3
0 0 0 1 1 1

684:
2 5 1 4 3 6
0 0 0 1 1 1

685:
5 2 1 4 3 6
0 0 0 1 1 0

686:
5 2 1 4 6 3
0 0 0 1 0 1

687:
5 2 1 6 4 3
0 0 0 0 1 1

688:
5 2 6 1 4 3
0 0 0 0 1 1

689:
5 6 2 1 4 3
0 0 0 0 1 1

690:
6 5 2 1 4 3
0 0 0 0 1 1

691:
6 5 2 1 3 4
1 1 0 0 1 1

692:
5 6 2 1 3 4
1 1 0 0 1 1

693:
5 2 6 1 3 4
1 0 1 0 1 1

694:
5 2 1 6 3 4
1 0 0 1 1 1

695:
5 2 1 3 6 4
1 0 0 1 1 1

696:
5 2 1 3 4 6
1 0 0 1 1 1

697:
2 5 1 3 4 6
0 1 0 1 1 0

698:
2 5 1 3 6 4
0 1 0 1 0 1

699:
2 5 1 6 3 4
0 1 0 0 1 1

700:
2 5 6 1 3 4
0 1 0 0 1 1

701:
2 6 5 1 3 4
0 0 1 0 1 1

702:
6 2 5 1 3 4
0 0 1 0 1 1

703:
6 2 1 5 3 4
1 0 0 1 1 1

704:
2 6 1 5 3 4
0 1 0 1 1 1

705:
2 1 6 5 3 4
0 0 1 1 1 1

706:
2 1 5 6 3 4
0 0 1 1 1 1

707:
2 1 5 3 6 4
0 0 1 1 1 1

708:
2 1 5 3 4 6
0 0 1 1 1 1

709:
2 1 3 5 4 6
0 0 1 1 1 0

710:
2 1 3 5 6 4
0 0 1 1 0 1

711:
2 1 3 6 5 4
0 0 1 0 1 1

712:
2 1 6 3 5 4
0 0 0 1 1 1

713:
2 6 1 3 5 4
0 0 0 1 1 1

714:
6 2 1 3 5 4
0 0 0 1 1 1

715:
6 2 1 3 4 5
1 0 0 1 1 1

716:
2 6 1 3 4 5
0 1 0 1 1 1

717:
2 1 6 3 4 5
0 0 1 1 1 1

718:
2 1 3 6 4 5
0 0 1 1 1 1

719:
2 1 3 4 6 5
0 0 1 1 1 1

720:
2 1 3 4 5 6
0 0 1 1 1 1

 

0
0
分享到:
评论

相关推荐

    全排列算法

    在本场景中,我们以铁路车厢的排列为例,探讨如何设计一个程序来生成所有长度为4的车厢序列,比如1,2,3,4的全排列。全排列算法在数据结构和算法课程设计中是一项常见的任务,它可以帮助学生理解递归和回溯等概念...

    整理的机试面试题库.docx

    请返回一个长度为 n 的数组 answer,按航班编号顺序返回每个航班上预订的座位数。 解决思路:使用排序算法,首先对预订记录进行排序,然后逐步扫描预订记录,对每个航班累加预订的座位数,最后输出结果数组。 本...

    手稿_V1.016

    ),因为全排列的数量为n的阶乘,其中n是输入数组的长度。对于较大的n值,这种方法可能会导致性能问题。为了优化,可以考虑使用回溯法,或者利用动态规划等其他策略。 总结来说,这个C++程序主要展示了如何使用递归...

    javascript算法题 求任意一个1-9位不重复的N位数在该组合中的大小排列序号

    具体题目是这样的: 从1–9中选取N个数字,组成不重复的N位数,从小到大进行编号,当输入其中任何一个数M时,能找出该数字对应 的编号。如 N=3,M=213. 输出:[123(1) , 132(2) , 213(3) , 231(4) , 312(5) , 321(6)...

    javascript算法题:求任意一个1-9位不重复的N位数在该组合中的大小排列序号

    首先看到题目想到的是生成一个从少到大的全排列的数组,然后再遍历数组得到对应的序号(数组下标加1),又或者想到一个个从小到大的生成push进数组,然后判断该数是不是当前题目给的数,如果是的话要求的序号就是当前...

    nonpermutek(N,K):无重复排列-matlab开发

    例如,如果你有10个不同的元素(编号为1到10),想要生成所有长度为5的排列,你可以这样调用: ```matlab N = 10; K = 5; permutations = nonpermutek(N, K); ``` `permutations`将会是一个多维数组,其中每个二维子...

    吉大 各种基本ACM必备算法基础

    当使用数组而不是优先队列实现时,其时间复杂度为O(N^2),其中N为节点的数量。这种实现方式简单易懂,但在大数据集上效率较低。 ##### DIJKSTRA O(E*logE) 通过使用优先队列(例如斐波那契堆),Dijkstra算法的时间...

    JAVA练习题(50题)

    - **实现思路**:通过循环或递归的方式计算斐波那契数列中的第n个数字。 #### 练习题2:质数判断 - **知识点**: - 质数的概念:只能被1和自身整除的大于1的自然数。 - 开平方根技巧:减少不必要的检查次数。 - ...

    C#编程经验技巧宝典

    54 &lt;br&gt;0075 用回溯法找出n个自然数中取r个数的全排列 55 &lt;br&gt;0076 约瑟夫环问题 56 &lt;br&gt;0077 猴子选大王 57 &lt;br&gt;0078 如何判断IP是否正确 57 &lt;br&gt;0079 如何将小写金额转换为大写金额 57...

Global site tag (gtag.js) - Google Analytics