10位同学依次登上一辆大巴

Posted 莫青铜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了10位同学依次登上一辆大巴相关的知识,希望对你有一定的参考价值。

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

以上是关于10位同学依次登上一辆大巴的主要内容,如果未能解决你的问题,请参考以下文章

32:合唱队

Vijos P1098 合唱队形

华为 合唱队 算法

动态规划合唱团

P1091 合唱队形

#yyds干货盘点# 动态规划专题:合唱队形