哪位大佬能说一下这样为什么不行吗
by zzzty___ @ 2019-07-13 10:26:08
@[左天佑](/space/show?uid=50787) 怕是这题不能开long long……
by ywy_c_asm @ 2019-07-13 10:34:51
@[ywy_c_asm](/space/show?uid=125124) 我知道要打高精度,但是我测了一下好像状态转移方程有点问题
by zzzty___ @ 2019-07-13 10:38:21
@[左天佑](/space/show?uid=50787) 感觉应该是区间大小的关系,按照题目要求应该是从大([1,m])到小([i,i])的。也不知倒过来会不会锅……
by 早右昕 @ 2019-07-13 10:38:38
@[左天佑](/space/show?uid=50787)
如下
~~~cpp
#include<bits/stdc++.h>
using namespace std;
const int maxs=80+3;
long long n,m,ans=0;
long long a[maxs][maxs];
long long f[maxs][maxs][maxs];
long long max(long long x,long long y){return x>y?x:y;};
long long Pow(int x)
{
if(x<=0) return 1;
long long num=1;
while(x--) num*=2;
return num;
}
int main()
{
memset(f,0,sizeof(f));
scanf("%lld%lld",&n,&m);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
scanf("%lld",&a[i][j]);
for(int i=1;i<=n;i++)
{
for(int j=m;j>=1;j--)
for(int k=j;k<=m;k++) {
int T=k-j+1;
f[i][j][k]=max(f[i][j+1][k]+a[i][j]*Pow(m-T+1),f[i][j][k-1]+a[i][k]*Pow(m-T+1));
}
}
for(int i=1;i<=n;i++) ans+=f[i][1][m];
cout<<ans<<endl;
return 0;
}
~~~
by 早右昕 @ 2019-07-13 10:40:39
@[早右昕](/space/show?uid=34920) 巨
by zzzty___ @ 2019-07-13 11:06:49