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

在自己的机器上很对啊 为什么总是Runtime Error?

Posted by 00412088 at 2005-03-05 03:17:14 on Problem 1163
C语言的:

#include<stdio.h>
#include<stdlib.h>

main()
{
	int n,i,j;
	int **d;
	scanf("%d",&n);
	d=malloc(n*sizeof(int *));
	for(i=0;i<n;i++)
	{
		d[i]=malloc(i*sizeof(int));
		for(j=0;j<=i;j++)
			scanf("%d",&d[i][j]);
	}
	for(i=n-2;i>=0;i--)
		for(j=0;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);
}

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