Cod sursa(job #1902179)
Utilizator | Data | 4 martie 2017 13:58:50 | |
---|---|---|---|
Problema | Farfurii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
using namespace std;
ifstream in ("farfurii.in");
ofstream out ("farfurii.out");
long long n,k,x,ceva,a,i;
int main()
{
in>>n>>k;
for(x=1;x*(x-1)/2<k;)
{
x++;
}
x--;
for(i=1;i<=n-x-1;i++)
out<<i<<" ";
a=x*(x+1)/2;
ceva=n+k-a;
out<< ceva<<" ";
for(i=n;i>=n-x;i--)
if(i!=ceva)
out<<i<<" ";
return 0;
}