749A Codeforces - Bachgold Problem
Solution in C++
#include <iostream>
using namespace std;
int n;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    if(n%2)
    {
        cout<<n/2<<"\n";
        n=(n-3)/2;
        while(n--)cout<<"2 ";
        cout<<3;
    }
    else
    {
        cout<<n/2<<"\n";
        n/=2;
        while(n--)cout<<"2 ";
    }
    return 0;
}
0 التعليقات:
إرسال تعليق