Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:第一道动态规划,贴代码纪念~~

Posted by dengd at 2010-02-03 15:19:34 on Problem 1163
In Reply To:第一道动态规划,贴代码纪念~~ Posted by:highspeed at 2010-01-01 11:01:26
> #include<iostream>
> 
> 
> using namespace std;
> 
> int main()
> {
> 	int a[101][101],i,j,n;
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 		for(j=0;j<=i;j++)
> 			scanf("%d",&a[i][j]);
> 	for(i=n-2;i>=0;i--)
> 		for(j=0;j<=i;j++)
> 			a[i][j]+=(a[i+1][j]>a[i+1][j+1]?a[i+1][j]:a[i+1][j+1]);
> 	printf("%d\n",a[0][0]);
> 	return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator