90分求助
2026-08-14 19:52:35
发布于:江苏
11阅读
0回复
0点赞



#include <bits/stdc++.h>
using namespace std;
long long n,x,sss,i = 2,t = 1;
int a[10005];
int s[10005];
void jc(int x)
{
for(int i = 1;i <= t;i ++)
{
s[i] = s[i] * x;
}
for(int i = 1;i <= t;i ++)
{
if(s[i] >= 10)
{
long long add = s[i] / 10;
s[i + 1] += add;
s[i] = s[i] % 10;
if(i + 1 > t) t = i + 1;
}
}
}
int main()
{
s[1] = 1;
cin >> n;
while(sss < n)
{
a[++ x] = i;
sss += i;
i ++;
}
a[sss - n - 1] = 0;
for(int i = 1;i <= x;i ++)
{
if(a[i] != 0) cout << a[i] << " ";
if(a[i] != 0) jc(a[i]);
}
cout << endl;
for(int i = t;i >= 1;i --)
{
cout << s[i];
}
cout << endl;
return 0;
}
全部评论 1
哪道题目?
5天前 来自 浙江
0A7879.最大乘积
4天前 来自 江苏
0










有帮助,赞一个