Cod sursa(job #3341923)
| Utilizator | Data | 21 februarie 2026 16:44:02 | |
|---|---|---|---|
| Problema | Farfurii | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef LOCAL
freopen("farfurii.in", "r", stdin);
freopen("farfurii.out", "w", stdout);
#endif
long long n, i, nr;
long long k, x;
cin >> n >> k;
x = 1;
while(x * (x - 1) / 2 <= k) {
x++;
}
//printf("%d ",x);
for(i = 1; i <= n - x; i++)
{
cout << i << " ";
}
nr = n - (x * (x - 1) * 1LL / 2 - k);
cout << nr << " ";
for(i = n; i > n - x; i--)
{
if(i != nr)
{
cout << i << " ";
}
}
return 0;
}