http:codeforces.comproblemsetproblem749A Bachgold Problem

xiaoxiao2021-02-28  29

尽量用2自然是最好的,如果是奇数最后一个用3即可。

#include <iostream> #include <string> #include <cstdio> #include <algorithm> #include <vector> #include <stack> #include <queue> #define MAX 100005 #define mod 998244353ll #define INF 0x3f3f3f3f #define ll long long using namespace std; int main() { freopen("a.txt", "r", stdin); freopen("b.txt", "w", stdout); int n; cin >> n; int t = n / 2, p = 2; cout << t << endl; if (n & 1) { p = 3; } for (int i = 1; i <= t - 1; ++i) { printf("2 "); } printf("%d\n",p); return 0; }
转载请注明原文地址: https://www.6miu.com/read-2622203.html

最新回复(0)