Advertisement
dvjsharma

Untitled

Mar 24th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.76 KB | None | 0 0
  1. // ~@dvjsharma~ || ~@dvjsharmaa~ //
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
  6. #define scan(arr) for(auto &x : arr) cin>>x;
  7. #define print(arr) for(auto &x : arr) cout<<x<<" "; cout<<endl;
  8. #define all(x) x.begin(), x.end()
  9. #define ll long long
  10. #define int long long int
  11. #define endl "\n"
  12. #define NO cout<<"NO\n";
  13. #define YES cout<<"YES\n";
  14. #define No cout<<"No\n";
  15. #define Yes cout<<"Yes\n";
  16. #define vi vector<int>
  17. #define vvi vector<vector<int>>
  18. #define pb push_back
  19. #define ppb pop_back
  20. #define mod 1e9+7
  21.  
  22. string binary(int n);                           //int to binary(string)
  23. int reversal(int n);                            //reverse intezers
  24. int ati(int arr[],int n);                       //array to intezer
  25. int digit_sum(int n);                           //sum of int digits
  26. int max_sub(string s,char a);                   //return max conse freq of a
  27. int lenint(int n);                              //length of any intezer
  28.  
  29. //**************************************************//
  30.  
  31. void solve(){
  32.     int n,k; cin>>n>>k;
  33.     if(k==1 or k==0){
  34.         for(int i=0; i<n-1; i++){
  35.             cout<<-1000<<" ";
  36.         }
  37.         int temp= (k==0? -1000 : 969);
  38.         cout<<temp<<endl;
  39.         return;
  40.     }
  41.     if(n>=k){
  42.         // cout<<n<<" "<<k<<endl;
  43.         int p=n-k;
  44.         // cout<<p<<endl;
  45.         for(int i=0; i<p; i++){
  46.             cout<<-1000<<" ";
  47.         }
  48.         int alpha=-968;
  49.         for(int i=0; i<k-1; i++){
  50.             cout<<alpha<<" ";
  51.             alpha++;
  52.         }
  53.         cout<<969<<endl;
  54.     }
  55.     else{
  56.        
  57.     }
  58. }
  59.  
  60. //**************************************************//
  61.  
  62. signed main(){
  63. fastio();
  64. int tc=1;
  65. cin>>tc;
  66. while(tc--){
  67.     solve();
  68. }
  69. return 0;
  70. }
  71.  
  72.  
  73.  
  74. int lenint(ll n){
  75.     return floor(log10(n) + 1);
  76. }
  77. int ati(int a[],int n){
  78.     int x=0;
  79.     for(int i=0; i<n; i++){
  80.         x+=a[i];
  81.         x*=10;
  82.     }
  83.     return(x/10);
  84. }
  85. int reversal(int n){
  86.     int x=0,j=(int)pow(10,(int)log10(n));
  87.     while(n){
  88.         x+=(n%10)*j;
  89.         n/=10;
  90.         j/=10;
  91.     }
  92.     return x;
  93. }
  94. string binary(int n){
  95.     string str="";
  96.     int binaryNum[32];
  97.     int i = 0;
  98.     while (n > 0) {
  99.         int x=n%2;
  100.         str.push_back(x+'0');
  101.         n = n / 2;
  102.     }
  103.     reverse(all(str));
  104.     return str;
  105. }
  106. int digit_sum(int n){
  107.     int x=0;
  108.     while(n){
  109.         x+=n%10;
  110.         n/=10;
  111.     }
  112.     return x;
  113. }
  114. int max_sub(string s, char a){
  115.     int temp=0,flag=0,ans=0;
  116.     for(int i=0; i<s.size(); i++){
  117.         if(s[i]==a){
  118.             temp++; flag=1;
  119.         }
  120.         else{
  121.             temp=0; flag=0;
  122.         }
  123.         if(flag==1 && temp>ans)
  124.             ans=temp;
  125.     }
  126.     return ans;
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement