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:求0MS代码

Posted by ayxg at 2012-03-03 10:29:43 on Problem 1163
In Reply To:求0MS代码 Posted by:adps2010_09274014 at 2010-07-31 19:36:00
> 0MS是怎么做到的呢  求代码

这个有时候0ms

#include <stdio.h>

#define MAX 100

int d[MAX + 1][MAX + 1];

int main()
{
	int i, j, n;

	scanf("%d", &n);

	for (i = 1; i <= n; ++i)
		for (j = 1; j <= i; ++j)
			scanf("%d", &d[i][j]);

	for (i = n - 1; i > 0; --i)
		for (j = 1; j <= i; ++j)
			d[i][j] += (d[i + 1][j] > d[i + 1][j + 1])? d[i + 1][j]:d[i + 1][j + 1];
	
	printf("%d\n", d[1][1]);

	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