- 高低位交换
- 2014-12-15 13:56:27 @
var a,d,s:int64;
b,c:array[0..33] of int64;
i:longint;
begin
readln(a);
for i:=32 downto 1 do
begin
b[i]:=a mod 2;
a:=a div 2;
end;
for i:=16 to 32 do
c[i-16]:=b[i];
for i:=1 to 16 do
c[i+16]:=b[i];
s:=1;d:=0;
for i:=32 downto 1 do
begin
d:=d+s*c[i];
s:=s*2;
end;
writeln(d);
end.
自己调试答案都是对的啊,为什么不能通过呢?
求Pascal大神解答
5 条评论
-
eGtl LV 6 @ 2014-12-18 19:21:29
好吧,我读书少
-
2014-12-18 15:52:12@
int64可以啊,直接用shl shr就好了
program vijos_1201;
var m,n:int64;
begin
readln(n);
m:=1 shl 16;
n:=(n mod m)shl 16+n shr 16;
writeln(n);
end. -
2014-12-15 20:52:07@
var a,b:longint;
begin
read(a,b);
write(swap(a,b));
end. -
2014-12-15 14:03:22@
用qword吧
-
2014-12-15 13:58:21@
难道int64不能用?
- 1