1 var 2 a:array[0..100] of longint; 3 n,i,j,k:longint; 4 ans:qword; 5 begin 6 readln(n,k); 7 i:=k; 8 while i<>0 do begin 9 inc(a[0]); 10 a[a[0]]:=i and 1; 11 i:=i shr 1; 12 end;ans:=1; 13 for i:=a[0] downto 1 do begin 14 ans:=ans*ans; 15 if a[i]=1 then ans:=ans*n; 16 end; 17 writeln(ans); 18 end.
时间: 2024-12-28 20:46:18