Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么会朝时#include <iostream.h> #include <memory.h> int max(int a,int b) { if (a>b) return a; else return b; } int matrix[100][100]; int number=0; int Try (int a,int b,int result) { if (a==number) { result=result+matrix[a][b]; } if (a<number) { result=result+matrix[a][b]; result=+max(Try (a+1,b,result),Try (a+1,b+1,result)); } return result; } int main() { memset (matrix,0,sizeof (matrix)); cin>>number; int a,b=0; for (a=0;a<number;a++) for (b=0;b<=a;b++) { cin>>matrix[a][b]; } cout<<Try (0,0,0)<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator