Skip to content

Commit 31de8db

Browse files
committed
Added 749A - Bachgold Problem.cpp
1 parent 9fca7a3 commit 31de8db

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

749A - Bachgold Problem.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
int main()
7+
{
8+
int n;
9+
cin>>n;
10+
if(n%2==0)
11+
{
12+
cout<<n/2<<endl;
13+
for(int i=1;i<=n/2;i++)
14+
{
15+
cout<<2<<" ";
16+
}
17+
}
18+
else
19+
{
20+
cout<<(n-3)/2+1<<endl;
21+
for(int i=1;i<=(n-3)/2;i++)
22+
{
23+
cout<<2<<" ";
24+
}
25+
cout<<3;
26+
}
27+
}
28+
29+
30+
31+
32+
33+
34+
35+

0 commit comments

Comments
 (0)