Yxc123 @ 2023-08-17 17:54:48
#include <iostream>
using namespace std;
const int N=1010;
int a[N][N];
int r;
int main()
{
cin >> r;
for(int i=0;i<r;i++)
{
for(int j=0;j<=i;j++)
{
cin >> a[i][j];
}
}
for(int i=r-2;i>=0;i--)
{
for(int j=0;j<=i;j++)
a[i][j]+=max(a[i+1][j],a[i+1][j+1]);
}
cout<<a[0][0]<<endl;
return 0;
}
本地编译器能过但提交不能过
by Ether_W @ 2023-08-17 17:56:47
std::max
函数需要包含cmath库
by Ether_W @ 2023-08-17 17:57:59
加上 #include<cmath>
by __LePetitPrince__ @ 2023-08-17 17:58:30
@Yxc123 我这交你的 A 了啊?你怕不是交的时候多摁了个键啥的
by __LePetitPrince__ @ 2023-08-17 17:58:50
@Ether_W max 是 iostream 里的
by Ether_W @ 2023-08-17 18:00:15
@LePetitPrince az
by liu_le_chen @ 2023-08-17 18:00:49
用万能头吧
by Ether_W @ 2023-08-17 18:00:52
@LePetitPrince 雀食
by liu_le_chen @ 2023-08-17 18:01:50
@LePetitPrince 赞同
by Yxc123 @ 2023-08-17 18:01:58
我交成python了
aaaaaaaaaaaa
by __LePetitPrince__ @ 2023-08-17 18:02:37
@Yxc123 ⑥