HII GUYS ..........
TYPE::
this is a easy dp problem but this is very good for DP beginners......
LOGIC::
after applying logic of question a very impotant issue is there
that how to write our code under 256BYTE..........
IMPORTANT THING FOR THIS-
1.space also occpy 1 byte of space so remove all spaces
2.declare veriable at a time
1
2 | #define s(v) scanf("%d",&v);
main(t,n,i,j){s(t)while(t--){s(n)int a[100][100];for(i=0;i<n;i++){for(j=0;j<=i;j++)s(a[i][j]) }for(i=n-2;i>=0;i--){for(j=0;j<=i;j++)a[i][j]+=a[i+1][j+1]>a[i+1][j]?a[i+1][j+1]:a[i+1][j];}printf("%d\n",a[0][0]);}}
|
1 comment:
my solution is taking 240BYTEs
if u know the solution less than this in c/c++........plz let me know
Post a Comment