-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path640_Division_1.cpp
More file actions
40 lines (40 loc) · 973 Bytes
/
640_Division_1.cpp
File metadata and controls
40 lines (40 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
vector<int> s,s1;
int j=1;
for(int i=1;i<k;i++)
{
s.push_back(j);
}
if((n-j*(k-1))%2!=0&&(n-j*(k-1)>0)){
cout<<"YES"<<endl;
for(auto it=s.begin();it!=s.end();it++)cout<<*it<<" ";
cout<<n-j*(k-1)<<endl;
}
else{
int p=2;
for(int i=1;i<k;i++)
{
s1.push_back(p);
}
if((n-p*(k-1))%2==0&&(n-p*(k-1))>0)
{
cout<<"YES"<<endl;
for(auto it=s1.begin();it!=s1.end();it++)
{
cout<<*it<<" ";
}
cout<<n-p*(k-1)<<endl;
}
else cout<<"NO"<<endl;
}
s.clear();s1.clear();
}
}