Cod sursa(job #1244532)
Utilizator | Data | 17 octombrie 2014 18:26:08 | |
---|---|---|---|
Problema | Farfurii | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <cstdio>
#include <cmath>
using namespace std;
long long unsigned i,n,m,k,x,y,N;
bool ok,q;
int main()
{
int n,k;
freopen("farfurii.in","r",stdin);
freopen("farfurii.out","w",stdout);
scanf("%llu",&n);
N=n;
scanf("%llu",&k);
n=N;
for(i=2;i*(i-1)<=k*2;i++);
m=i;
if(m*(m-1)>2*k)m--;
for(i=1;i<=n-m-1;i++)
printf("%llu ",i);
x=n-((((m)*(m+1))/2)-k);
if(!q)
printf("%llu ",x);
else
x=0;
ok=0;
for(i=0;i<m&&i<n;i++)
{
y=n-i;
if(x==y)
ok=1;
if(ok)
y--;
printf("%llu ",y);
}
return 0;
}