Kapil always likes to eat and he has a diet plan. He has an array of elements indicating the calorie of food , he can consume in a day.
In his diet plan he cannot eat on for three consecutive days. But Kapil is very fond of eating , so he decided to take as much as calorie despite remembering the fact that he cannot eat on three consecutive days. Help him in finding amount of calorie he could take.
The first line will contain an integer T denoting the no of test cases.Each test case contains 2 lines.The first line of each test case will contain an integer n i.e number of days. In the next line are n space separated values of ai indicating the intake of calorie per day.
Print the maximum amount of calorie, Kapil can take in a new line .
3 2 1 10 3
3 2 3 2 3 5 1 3
(i)In first case he will eat on 1st,2nd,4th and 5th day (3+2+10+3)=18
(ii)Similarly in second case, (3+3+3+5+3)=17
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.