Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int Q;
- scanf("%d", &Q);
- while(Q--){
- int sum, n;
- scanf("%d%d", &sum, &n);
- if(sum % 2 == n % 2){
- int lst = sum - n + 1;
- if(lst < 0){
- cout << "NO\n";
- continue;
- }
- cout << "YES\n";
- for(int i = 1; i < n; ++i){
- cout << "1 ";
- }
- cout << lst << '\n';
- } else if(sum % 2 == 0){
- int lst = sum - n - n + 2;
- if(lst <= 0){
- cout << "NO\n";
- continue;
- }
- cout << "YES\n";
- for(int i = 1; i < n; ++i){
- cout << "2 ";
- }
- cout << lst << '\n';
- } else {
- cout << "NO\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement