lina_os

Untitled

Nov 3rd, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.  
  10. int t; cin>>t;
  11. while(t>0){t--;
  12. long long n,s; cin>>n>>s;
  13. if(n>s)cout<<1<<" "<<s-1<<endl;
  14. else if(n*(n+1)/2<s)cout<<-1<<endl;
  15. else if(n<=s){
  16. long long sum=0;
  17. for(int i=(n+1)/2; i>0; i--){
  18. if(sum==s)break;
  19. sum+=i;
  20. cout<<i<<" ";
  21. }cout<<endl;
  22. }
  23. }
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment