Captain needs new Heliwings
All submissions for this problem are available.
Captain America is driving a plane, but there's a little problem. He can fly higher but cannot move down. He can only land the plane if he presses the RED button. Count the number of buildings he can cover in that manner and earn building points!!
- The first line of the input contains an integer T denoting the number of buildings in all.
- The first line of each test case contains a single integer N denoting the number of buildings. The second line contains N space-separated building levels(=building points). (Initial level is 0)
- For each test case, output a single line containing total builings points earned in each test case.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ T ≤ 1000
- 1 ≤ N ≤ 100
Input: 3 5 1 4 3 6 7 4 8 9 1 5 7 1 4 8 2 5 6 9 Output: 18 17 22
Example case 1. The Captain can move from 0 to 1, 1 to 4 but not from 4 to 3, then again he can move from 4 to 6 and then to 7.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.