codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<iostream> #include<algorithm> using namespace std; #define N 200 int bestpath(int A[N][N], int x, int x, int y); int main() { int T, i, j, k; cin>>T; for(i=0; i<T; i++) { //cin>>N; int A[N][N]; for(j=0; j<N; j++) { for(k=0; k<N; k++) { cin>>A[j][k]; } } int ans= bestpath(A, N, 0, 0); cout<<ans<<endl; } return 0; } int bestpath(int A[N][N], int zz, int x, int y) { if(x>= N || y>=N) return 0; if(x == y == N-1) return 0; int value= A[x][y]; // Error: Invalid type 'int[int]' for array subscript. value+= max(bestpath(A, x+1, y, N), bestpath(A, x, y+1, N)); return value; }
Private
[
?
]
Run code
Submit