自己水平太低,不丢人。
结论是最后选取的数后缀一定是若干个9,暴举即可。然而暴举也有暴举的艺术。

ll n;

ll dfs(ll n) {
    if (n == 0) return 1;
    if (n < 10) return n;
    return max(dfs(n / 10) * (n % 10), dfs(n / 10 - 1) * 9);
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    cout << dfs(n) << endl;
    return 0;
}
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。