Advertisement
amine99

Untitled

Jun 3rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  5. #define ALL(x) x.begin(),x.end()
  6. #define SZ(x) x.size()
  7. #define PB push_back
  8. #define MP make_pair
  9. #define F first
  10. #define S second
  11. typedef long long LL;
  12. typedef vector<int> VI;
  13. typedef pair<int,int> PI;
  14.  
  15. int t,n;
  16. LL x;
  17.  
  18. void solve() {
  19.     cin >> x >> n;
  20.     LL a[n];
  21.     for(int i = 0; i < n; i++)
  22.         a[i] = (LL)x / n;
  23.     for(int i = n - 2; i >= n - 1 - x % n ; i--)
  24.         a[i]++;
  25.     for(int i = 0; i < n; i++)
  26.         cout << a[i] << " ";
  27.     cout << "\n";
  28. }
  29.  
  30. int main() {
  31.     io
  32.     cin >> t;
  33.     while(t--)
  34.         solve();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement