Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- int n, s; cin >> n >> s;
- s = s + n*(n + 1)/2 - 2;
- vector<int> a(n - 1);
- for(int i = n; i >= 2 && s; i--)
- if(2*i == s || 2*i <= s - 4)
- s -= 2*i,
- a[i - 2] = 1;
- if(s) return cout << "Impossible", 0;
- cout << 1;
- for(int i = 0; i <= n - 2; i++)
- cout << "-+"[a[i]] << i + 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement