代码翻译 谁能把这段C++代码翻译成Pascal

来源:百度知道 编辑:UC知道 时间:2024/05/05 21:22:29
int s = (1 << k) - 1;
while (!(s & 1 << N))
{
int lo = s & ~(s - 1);
int lz = (s + lo) & ~s;
s |= lz;
s &= ~(lz - 1);
s |= (lz / lo / 2) - 1;
}

var
s,lo,lz:longint;
begin
s:=1 shl k-1;
while s and 1 shl n=0 do begin
lo:=s and (not (s-1));
lz:=(s+lo) and (not s);
s:=s or lz;
s:=s and (not (lz-1));
s:=s or ((lz div lo div 2)-1);
end;
end.

楼主 好强 能熟练运用低级运算符