749A. Bachgold Problem Solution
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- int q=2;
- int c=0;
- cin>>n;
- if(n%2==0)
- {
- int p=n/2;
- cout<<p<<endl;
- for(int i=0;i<p;i++)
- cout<<2<<" ";
- }
- else{
- q=n/2-1;
- cout<<q+1<<endl;
- for(int j=0;j<q;j++)
- cout<<2<<" ";
- }
- if(n%2!=0)cout<<3;
- return 0;
- }
Comments
Post a Comment