Problem Statement | |||||||||||||
NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.
Taro and Hanako are playing Bunny Puzzle. There are several bunnies standing on a line. You are given a int[] bunnies, where each element is the initial position of a single bunny. They must perform the following routine exactly once:
The jump is not allowed if another bunny is already at point 2*b-a. The jump is also not allowed if A jumps over more than one bunny. Return the number of different ways in which Taro and Hanako can choose the pair of bunnies A and B. "A jumps over B" and "B jumps over A" are considered to be different. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | bunnies will contain between 2 and 50 elements, inclusive. | ||||||||||||
- | Each element of bunnies will be between -10^6 and 10^6, inclusive. | ||||||||||||
- | bunnies will be sorted in strictly ascending order. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|