CF1307A Cow and Haybales

题目描述

有n个数,你每次可以选择相邻的两个数i和j,使ai-1,aj+1,你的目的是经过d此操作后,使得a1最大。

输入格式

第一行一个整数t(1≤t≤100),表示有t组数据。 每组数据第一行2个整数,表示n和d( 1≤n,d≤100)。 第2行n个整数,分别表示 a1, a2……,an ( 0≤ai≤100 )

输出格式

t行。每行表示第t次操作a1的最大值。

说明/提示

In the first test case of the sample, this is one possible way Bessie can end up with $ 3 $ haybales in pile $ 1 $ : - On day one, move a haybale from pile $ 3 $ to pile $ 2 $ - On day two, move a haybale from pile $ 3 $ to pile $ 2 $ - On day three, move a haybale from pile $ 2 $ to pile $ 1 $ - On day four, move a haybale from pile $ 2 $ to pile $ 1 $ - On day five, do nothing In the second test case of the sample, Bessie can do nothing on the first day and move a haybale from pile $ 2 $ to pile $ 1 $ on the second day.