我需要一些帮助才能处理以下逻辑。 该方案得到许多分类输入,如<代码>10,16,3,17,21,29,6<>。
需遵循的逻辑是:
设想1:
首先选择最多的4项投入,即<代码>16,17,21,29。 现在将价值观分配给A、B、C和D:
- A = smallest in the selected 4
- B = biggest in the selected 4
- C = second smallest in the selected 4
- D = third smallest in the selected 4
显示:
A = 16
B = 29
C = 17
D = 21
设想:2
如果用户只向A、B、C转让3项投入,如<代码>3,6,10,而忽略D
显示:
A = 3
B = 10
C = 6