NC222436. [USACOFeb2021G]StoneGame
描述
输入描述
The first line contains N.
The second line contains N space-separated integers a1,…,aN.
输出描述
Print the number of ways Bessie can remove stones on her first turn in order to guarantee a win.Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).
示例1
输入:
1 7
输出:
4
说明:
Bessie wins if she removes 4, 5, 6, or 7 stones from the only pile. Then the game terminates immediately.示例2
输入:
6 3 2 3 2 3 1
输出:
8
说明:
Bessie wins if she removes 2 or 3 stones from any pile. Then the two players will alternate turns removing the same number of stones, with Bessie making the last move.