Pagini recente » Cod sursa (job #152662) | Cod sursa (job #2089888) | Cod sursa (job #918454) | Cod sursa (job #791147) | Cod sursa (job #2939942)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("farfurii.in");
ofstream fout("farfurii.out");
const int NMAX = 1e5+5;
long long n, k, arr[NMAX];
inline void solve()
{
long long cnt = 1, a;
while(cnt * (cnt + 1) <= k * 2)
cnt++;
for(int i=1;i<n-cnt;++i)
fout << i << ' ';
a = n - (cnt * (cnt + 1) /2 - k);
fout << a << ' ';
for(int i=n;n-cnt<=i;--i)
if(i!=a)
fout << i << ' ';
}
int main()
{
fin >> n >> k;
solve();
}