有沒有大佬帮我看看为什么我这个__int128 只有七十分,我是用dp做的,t记录的是 ai,j 中最后一次*号的位置,
a[i][j]=max(a[i−1][j−1]∗(s[i−1][j−1]),a[i−1][j]∗10+a[t[i−1][j]][j−1]∗(s[i]−′0′)))
#include<bits/stdc++.h>
using i128 = unsigned __int128_t;
std::string s;
i128 a[50][10];
int t[50][10];
void write(i128 x)
{
if (x > 9 )
write(x / 10);
putchar(x % 10 + '0');
}
signed main()
{
// std::ios::sync_with_stdio(0);
// std::cin.tie(0),std::cout.tie(0);
int n, k;
std::cin >> n >> k;
std::cin >> s;
a[0][0] = s[0] - '0';
for (int i = 1; i < n; i++)
{
a[i][0] = (a[i - 1][0]) * 10 + s[i] - '0';
for (int j = 1; j <= k && (a[i - 1][j - 1] | a[i - 1][j]); j++)
{
if (a[i - 1][j - 1] != 0)
{
a[i][j] = a[i - 1][j - 1] * (s[i] - '0');
t[i][j] = i - 1;
}
if (a[i - 1][j] == 0)continue;
if ( a[i][j] < a[i - 1][j] * 10 + (s[i] - '0') * a[t[i - 1][j]][j - 1])
{
a[i][j] = a[i - 1][j] * 10 + (s[i] - '0') * a[t[i - 1][j]][j - 1];
t[i][j] = t[i - 1][j];
}
if (t[i][j] == 0)
t[i][j] = t[i - 1][j];
}
}
write(a[n - 1][k]);
return 0;
}