蒟蒟,求助,大佬,呜呜……

P1005 [NOIP2007 提高组] 矩阵取数游戏

@[oier01](/user/721959) __int128可以水过去,记得手写快读快写。
by masonpop @ 2022-12-02 16:20:00


@[masonpop](/user/614725) 本蒟蒻不会qwq
by __pig__ @ 2022-12-03 15:04:31


@[oier01](/user/721959) 您可以参考一下我这个。 * 其实就是一种数的类型,只不过不能用cin/cout 要手写输出而已。 ```cpp #include <bits/stdc++.h> using namespace std; const int maxn=2000; inline void print(__int128 x) { if(x>9)print(x/10); putchar(x%10+'0'); } int n,m; int a[maxn]; __int128 ans; __int128 f[maxn][maxn]; int main() { ios::sync_with_stdio(false); cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>a[j]; } memset(f,0,sizeof(f)); for(int len=0;len<=m;len++) { for(int l=1;l<=m-len;l++) { int r=l+len; f[l][r]=2*max(f[l+1][r]+a[l],f[l][r-1]+a[r]); } } ans+=f[1][m]; } print(ans); return 0; } ```
by masonpop @ 2022-12-03 16:16:46


@[masonpop](/user/614725) 蟹蟹^_^
by __pig__ @ 2022-12-03 16:17:49


|