| ||||||||||
| 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 | |||||||||
Re:0MS代码In Reply To:求0MS代码 Posted by:adps2010_09274014 at 2010-07-31 19:36:00 #include <stdio.h>
int main()
{
int n,i,j;
int a[101][101];
scanf("%d",&n);
for (i=0;i<n;i++)
{
for (j=0;j<i+1;j++)
{
scanf("%d",&a[i][j]);
}
}
for (i=n-2;i>=0;i--)
{
for (j=0;j<n-1;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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator