|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||128 MB||1||1||1||100.000%|
We are given a two-pan balance and n weights of different masses a1, a2, …, an. We are to put each one of the given weights on the balance, one after another, in such a way that at any moment the left pan is never heavier than the right pan. At each step, we choose one weight that is not yet placed on the balance, and we place it either on the left pan or on the right pan. We continue these steps, until we use all the weights. Write program balance, which calculates the number of ways to do this.
The integer n is given on the first row of the standard input (0 < n < 10). There are n integers on the second row: a1, a2, …, an (0 < a1, a2, …, an < 1000).
Your program have to output a single integer on the standard output – the searched number of ways.
3 1 2 4