acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • AC

    #include <bits/stdc++.h> using namespace std; int a[10001] = {}; int s[10001] = {}; int n, len = 1; void mul(int x) { for (int i = 1; i <= len; i ) { s[i] *= x; } for (int i = 1; i <= len; i) { s[i + 1] += s[i] / 10; s[i] %= 10; } while (s[len + 1] > 0) { len ; s[len + 1] += s[len] / 10; s[len] %= 10; } } int main() { cin >> n; if (n == 3) { cout << 1 << " " << 2 << endl; cout << 2 << endl; return 0; } if (n == 4) { cout << 1 << " " << 3 << endl; cout << 3 << endl; return 0; } s[0] = s[1] = 1; int Sum = 0, tot = 0; for (int i = 2; Sum < n; Sum += i, i) { a[++ tot] = i; } if (Sum > n + 1) { a[Sum - n - 1] = 0; } else if (Sum == n + 1) { a[tot] , a[1] = 0; } for (int i = 1; i <= tot; i) { if (a[i]) { cout << a[i] << " "; mul(a[i]); } } cout << endl; for (int i = len; i >= 1; i--) { cout << s[i]; } cout << endl; return 0; }

    userId_undefined

    ༺ཌༀ元气满满ༀད༻

    秩序白银
    52阅读
    0回复
    1点赞
首页