Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main(){
- int t; cin>>t;
- while(t>0){t--;
- long long n,s; cin>>n>>s;
- if(n>s)cout<<1<<" "<<s-1<<endl;
- else if(n*(n+1)/2<s)cout<<-1<<endl;
- else if(n<=s){
- long long sum=0;
- for(int i=(n+1)/2; i>0; i--){
- if(sum==s)break;
- sum+=i;
- cout<<i<<" ";
- }cout<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment