55???

P1216 [USACO1.5] [IOI1994]数字三角形 Number Triangles

风马少年 @ 2017-05-06 11:04:07

为什么是55分??!

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int a[105][105];
int ans,m;
int f(int x,int y)
{
    if(x==m)return a[x][y];
    return a[x][y]+max(f(x+1,y+1),f(x+1,y));
}
int main()
{
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
        for(int k=1;k<=i;k++)scanf("%d",&a[i][k]);
        ans=f(1,1);
    printf("%d",ans);
    return 0;
}

by guobaipeng0 @ 2017-05-16 13:03:47

我也是这样,


by 暮影灰狼 @ 2017-06-10 10:28:13

数组开小了qwq题目数据读串了


|