格式化代码

jinpeiyu 2023-11-25 16:09:23 3 返回题目


#include <bits/stdc++.h> #define int long long

using namespace std; const int N = 3e4 + 1e3; int n, t = 1; int a[N], s[N]; void cj(int x) { for (int i = 1; i <= t; i++) s[i] *= x; for (int i = 1; i <= t; i++) { if (s[i] >= 10) { int x = s[i] / 10; s[i + 1] += x; s[i] %= 10; if (i + 1 > t) t = i + 1; } } } signed main() { s[1] = 1; cin >> n; int sh = n / 3, yu = n % 3; for (int i = 1; i <= sh - 1; i++) cj(3); if (yu <= 1) cj(3 + yu); else cj(6); cout << t << "\n"; int sum = 1; if (t >= 100) for (int i = t; sum <= 100; i--, sum++) cout << s[i]; else for (int i = t; i >= 1; i--) cout << s[i]; return 0; }


1.高精度计算!!! 2.余1少乘一个3,换乘4;其他尽量多成3

{{ vote && vote.total.up }}