#include #include #include using namespace std; const int maxn=20; const int oo=1e9; int T,res; int n,A[maxn][maxn],B[maxn][maxn]; int cal(int s) { memset(B,0,sizeof(B)); for(int c=0;c1) sum+=B[r-2][c]; if(c>0) sum+=B[r-1][c-1]; if(c