CF455A Boredom
题目描述
亚力克斯不喜欢无聊。
所以每当他感到无聊他就会想出一些游戏。一个冬天的晚上他想出了一个游戏并且决定开始玩这个游戏。
给定一个有 $n$ 个元素的序列 $\{a_n\}$。你可以做若干次操作。在一次操作中我们可以取出一个数(假设他为 $x$)并删除它,同时删除所有的序列中值为 $x+1$ 和 $x-1$ 的数。这一步操作会给玩家加上 $x$ 分。
输入格式
无
输出格式
无
说明/提示
Consider the third test example. At first step we need to choose any element equal to $ 2 $ . After that step our sequence looks like this $ [2,2,2,2] $ . Then we do $ 4 $ steps, on each step we choose any element equals to $ 2 $ . In total we earn $ 10 $ points.