MAXWOODS  MAXIMUM WOOD CUTTER
Problem Statement:
The image explains it all. You initially step at 0,0 facing right. At each step you can move according to the conditions specified in the image. You cannot step into the blocked boxes (in blue). Find the maximum number of trees you can cut.
Input:
The first line consists of an integer t, the number of test cases. For each test case the first line consists of two integers m and n, the number of rows and columns. Then follows the description of the matrix M.
M[i][j]=’T’ if the region has a tree.
M[i][j]=’#’ if the region is blocked.
M[i][j]=’0’ (zero) otherwise.
Output:
For each test case find the maximum trees that you can cut.
Input Constraints:
1<=t<=10
1<=m,n<=200
Example:
Sample Input:
4 5 5 0TTTT T#T#0 #TT#T T00T0 T0#T0 1 1 T 3 3 T#T TTT T#T 1 1 #
Sample Output:
8 1 3 0
Solution for test case #1:
hide comments
Deepak :
20160419 23:51:44
silly mistake gave me 2 WAs.nice one to do ;) 

Vivek Mangal:
20160221 17:55:37
[spoiler] and accepted Last edit: 20160729 22:15:55 

ngoduchuy64:
20151221 04:34:52
3 attempts still getting WA 

Abishek:
20150917 13:46:48
simple problem ..after this try BYTESM2. similar concept . 

abhijeet gusain:
20150219 13:14:36
just use desi jugaad .. 

sheldon:
20150109 20:50:18
nice ques...finally accepted..:) 

S:
20141225 20:37:02
I don't know what is wrong in my code...someone please check it or give me some tricky cases.


Ruchir Thaman:
20141024 12:26:19
If the initial position contains a blocked box,the answer has to be zero,costed me 2 WA. 

Anuva Agarwal:
20141015 19:58:06
Can't believe it turned out to be THIS easy :D 

SHIVAM DIXIT:
20141010 14:22:30
good [spoiler removed] for beginners :) Last edit: 20141112 00:40:37 
Added by:  cegprakash 
Date:  20121014 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 GOSU 
Resource:  Inspired from http://codeforces.com/problemset/problem/115/B 