1 条题解

  • 0
    @ 2026-10-25 17:16:47

    思路

    2N-1个格子的时间约束迫使只向右下,计入起终费用。

    参考程序(C++11)

    #include <bits/stdc++.h>
    using namespace std;
    int main(){int n;cin>>n;vector<long long>d(n+1,LLONG_MAX/4);d[1]=0;for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){long long x;cin>>x;d[j]=min(d[j],d[j-1])+x;}cout<<d[n]<<'\n';}
    
    • 1

    信息

    ID
    1270
    时间
    1000ms
    内存
    64MiB
    难度
    普及−
    标签
    递交数
    1
    已通过
    1
    上传者