\* 我读入的时候写反了求大佬勿喷/dk/dk/dk
```cpp
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
inline int read(){
int x=0;bool f=0;
char ch=getchar();
while(ch<'0'||ch>'9')
f=(ch=='-'),ch=getchar();
while(ch>='0'&&ch<='9')
x=x*10+ch-'0',ch=getchar();
return f?-x:x;
}
string read_str()
{
string x="";bool f=0;
char ch=getchar();
while(ch<'0'||ch>'9')f=(ch=='-'),ch=getchar();
while(ch>='0'&&ch<='9')x=x+ch,ch=getchar();
return f?("-"+x):x;
}
void write_str(string str)
{
for(int p=0;p<str.size();p++)
putchar(str[p]);
}
string add(string s1,string s2)
{
string ans="";
if(s2.size()<s1.size())while(s2.size()!=s1.size())s2="0"+s2;
if(s1.size()<s2.size())while(s1.size()!=s2.size())s1="0"+s1;
int a=0,b=0,c=0;
for(int p=s2.size()-1;p>=0;p--)
{
a=s1[p]-'0',b=s2[p]-'0';
ans=char(((a+b+c)%10)+'0')+ans;
c=(a+b+c)/10;
}
if(c==1)ans="1"+ans;
return ans;
}
int a[4100],b[4100],c[4100];
string mul(string s1,string s2)
{
memset(a,0,sizeof(a)),memset(b,0,sizeof(b)),memset(c,0,sizeof(c));
if(s1=="0"||s2=="0")return "0";
for(int p=1;p<=s1.size();p++)a[p]=int(s1[s1.size()-p]-'0');
for(int p=1;p<=s2.size();p++)b[p]=int(s2[s2.size()-p]-'0');
for(int p=1;p<=s2.size();p++)
for(int i=1;i<=s1.size();i++)
c[p+i-1]+=a[i]*b[p];
int len=s1.size()+s2.size();
for(int p=1;p<len;p++)
if(c[p]>9)
c[p+1]+=(c[p]/10),c[p]%=10;
while(len&&!c[len])len--;
string ans="";
for(int p=len;p>=1;p--)
ans=ans+char(c[p]+'0');
return ans;
}
string Max(string x,string y)
{
int lx=x.size(),ly=y.size();
if(lx>ly)return x;
else if(ly>lx)return y;
else if(x==y)return x;
else
{
for(int p=0;p<lx;p++)
if(x[p]>y[p])return x;
else if(y[p]>x[p])return y;
}
}
string A[110][110],f[110][110];
int main()
{
int n,m;
string ans="0";
n=read(),m=read();
for(int p=1;p<=n;p++)
for(int i=1;i<=m;i++)
A[p][i]=read_str();
for(int p=1;p<=n;p++)
{
for(int i=0;i<=100;i++)
for(int j=0;j<=100;j++)
f[i][j]="0";
for(int len=0;len<=m;len++)
for(int l=1;l+len<=m;l++)
f[l][l+len]=Max(add(mul("2",f[l+1][l+len]),mul("2",A[p][l])),add(mul("2",f[l][l+len-1]),mul("2",A[p][l+len])));
ans=add(ans,f[1][m]);
}
write_str(ans);
}
```
这是勇敢的加入了不知道能不能快速读入字符串的代码,但是还是 T 了/dk/dk/dk
by SIXIANG32 @ 2021-01-31 15:11:56
这个 add 是平方复杂度吧 /fad
by xzggzh1 @ 2021-01-31 15:21:08
s2="0"+s2; 复杂度不对吧
by MatrixCascade @ 2021-01-31 15:26:24
@[MatrixCascade](/user/154101) 那怎么改啊/dk/dk/dk
by SIXIANG32 @ 2021-01-31 15:28:15
草,改了也不对 不知道有没有其它问题
by MatrixCascade @ 2021-01-31 15:32:26
@[SIXIANG](/user/298549) 手写int128,比高精好写多了(((
by Stinger @ 2021-01-31 15:46:22
@[zhangqs](/user/361308) 艹/fad
by SIXIANG32 @ 2021-01-31 15:50:20
为什么要用字符串啊
手打一个struct做高精吧
by Leville @ 2021-03-21 16:56:20