- 高低位交换
- 2009-08-02 21:37:05 @
var i,j,n:longint;
k:int64;
s:string;
function tentotwo(x:longint):string;
var i,j,k:longint;
s:string;
begin
tentotwo:='';
repeat
k:=x mod 2;
x:=x div 2;
str(k,s);
tentotwo:=s+tentotwo;
until x=0;
while length(tentotwo)32 do tentotwo:='0'+tentotwo;
exit(tentotwo);
end;
function twototen(x:string):int64;
var i,t,k:longint;
begin
while x[1]='0' do delete(x,1,1);
t:=1;twototen:=0;
for i:=1 to length(x) do begin
if i1 then t:=t*2;
val(x[length(x)-i+1],k);
twototen:=twototen+k*t;
end;
exit(twototen);
end;
function jh(x:string):string;
var i,j:string;
begin
i:=copy(x,1,16);
j:=copy(x,17,16);
x:=j+i;
exit(x);
end;
begin
readln(n);
s:=tentotwo(n);
s:=jh(s);
k:=twototen(s);
writeln(k);
end.
3 条评论
-
yugeyang LV 10 @ 2014-12-04 18:59:29
include <cstdio>
using namespace std;
unsigned int n;
int main(){
scanf( "%u" , &n );
printf( "%u\n" , n >> 16 | n << 16 );
return 0;
} -
2009-08-02 22:35:03@
我也给你一个……
VAR A:cardinal;
begin
readln(a);
write(swp(a));
end. -
2009-08-02 21:52:47@
直接给你AC的程序:
var
n:dword;
begin
readln(n);
writeln(n shr 16+n shl 16);
end.
- 1