10位同学依次登上一辆大巴,其中5个男同学,5个女同学,要求任何时候车上男同学的人数都不少于女同学的人数,不考虑有人下车的情况,请问总共有多少种上车顺序?
WITH a AS(
SELECT ‘m1‘ NAME
,1 VALUE
FROM dual
UNION ALL
SELECT ‘m2‘ NAME
,1 VALUE
FROM dual
UNION ALL
SELECT ‘m3‘ NAME
,1 VALUE
FROM dual
UNION ALL
SELECT ‘m4‘ NAME
,1 VALUE
FROM dual
UNION ALL
SELECT ‘m5‘ NAME
,1 VALUE
FROM dual
UNION ALL
SELECT ‘fm1‘ NAME
,-1 VALUE
FROM dual
UNION ALL
SELECT ‘fm2‘ NAME
,-1 VALUE
FROM dual
UNION ALL
SELECT ‘fm3‘ NAME
,-1 VALUE
FROM dual
UNION ALL
SELECT ‘fm4‘ NAME
,-1 VALUE
FROM dual
UNION ALL
SELECT ‘fm5‘ NAME
,-1 VALUE
FROM dual
)
SELECT COUNT(*)
from a
,a a1
,a a2
,a a3
,a a4
,a a5
,a a6
,a a7
,a a8
,a a9
WHERE a.name<>a1.name
AND a.name<>a2.name AND a1.name<>a2.name
AND a.name<>a3.name AND a1.name<>a3.name AND a2.name<>a3.name
AND a.name<>a4.name AND a1.name<>a4.name AND a2.name<>a4.name AND a3.name<>a4.name
AND a.name<>a5.name AND a1.name<>a5.name AND a2.name<>a5.name AND a3.name<>a5.name AND a4.name<>a5.name
AND a.name<>a6.name AND a1.name<>a6.name AND a2.name<>a6.name AND a3.name<>a6.name AND a4.name<>a6.name AND a5.name<>a6.name
AND a.name<>a7.name AND a1.name<>a7.name AND a2.name<>a7.name AND a3.name<>a7.name AND a4.name<>a7.name AND a5.name<>a7.name AND a6.name<>a7.name
AND a.name<>a8.name AND a1.name<>a8.name AND a2.name<>a8.name AND a3.name<>a8.name AND a4.name<>a8.name AND a5.name<>a8.name AND a6.name<>a8.name AND a7.name<>a8.name
AND a.name<>a9.name AND a1.name<>a9.name AND a2.name<>a9.name AND a3.name<>a9.name AND a4.name<>a9.name AND a5.name<>a9.name AND a6.name<>a9.name AND a7.name<>a9.name AND a8.name<>a9.name
AND a.value>=0
AND a.value+a1.value>=0
AND a.value+a1.value+a2.value>=0
AND a.value+a1.value+a2.value+a3.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value+a5.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value+a5.value+a6.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value+a5.value+a6.value+a7.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value+a5.value+a6.value+a7.value+a8.value>=0
AND a.value+a1.value+a2.value+a3.value+a4.value+a5.value+a6.value+a7.value+a8.value+a9.value>=0
;
604800