Advertisement
Saleh127

Cf 1095C

Aug 3rd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7.  
  8. int a,c,d,e,i,j,k,l;
  9. cin>>a>>c;
  10. int x[c];
  11. d=c;
  12. for(i=0;i<c;i++)
  13. {
  14. x[i]=1;
  15. }
  16. for(i=c-1;i>=0;i--)
  17. {
  18. while(d+x[i]<=a)
  19. {
  20. d+=x[i];
  21. x[i]*=2;
  22. }
  23. }
  24. if(d!=a)
  25. {
  26. cout<<"NO"<<endl;
  27. }
  28. else
  29. {
  30. cout<<"YES"<<endl;
  31. for(i=0;i<c;i++)
  32. {
  33. cout<<x[i]<<" ";
  34. }
  35. }
  36. return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement