Pagini recente » Cod sursa (job #2830856) | Cod sursa (job #844614) | Cod sursa (job #391243) | Cod sursa (job #749868) | Cod sursa (job #70943)
Cod sursa(job #70943)
var a:array[0..110000]of integer;
n,m,i,j:longint;
z,x,k:int64;
begin
assign(input,'farfurii.in');
reset(input);
assign(output,'farfurii.out');
rewrite(output);
readln(n,k);
for m:=2 to n+1 do
begin
z:=m*(m-1) div 2;
if z>k then break;
end;
dec(m);
for i:=1 to n-m-1 do
begin
write(i,' ');
a[i]:=1;
end;
x:=m;
z:=x*(x+1) div 2;
z:=z-k;
if n=1 then z:=0;
if z>0 then
begin
x:=n-z;
a[x]:=1;
if x>0 then write(x,' ');
end;
for i:=n downto n-m do
begin
if i<1 then break;
if a[i]=1 then continue;
write(i,' ');
end;
close(output);
end.