- 笨笨的瓮中捉鳖
- 2009-08-09 20:05:14 @
我的思路就是利用公式+高精 - -
最后说我128错误 . 我不知道为什么``
var m,n,i,j:longint;
f:array[1..1000,1..1000] of string;
ss:string;
function jia(s1,s2:string):string;
var a,b:array[1..10000] of byte;
k,l1,l2,i,j:integer;tmpstr:string;
begin
l1:=length(s1);l2:=length(s2);
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
if l1>l2 then j:=l1 else j:=l2;
k:=0;
for i:=l1 downto 1 do
begin
inc(k);
a[k]:=ord(s1[i])-48;
end;
k:=0;
for i:=l2 downto 1 do
begin
inc(k);
b[k]:=ord(s2[i])-48;
end;
for i:=1 to j do
begin
a[i]:=a[i]+b[i];
if a[i]>=10 then
begin
a[i]:=a[i]-10;
a:=a+1;
end;
end;
if a[j+1]=0 then j:=j-1;
tmpstr:='';
for i:=j+1 downto 1 do
tmpstr:=tmpstr+chr(a[i]+48);
jia:=tmpstr
end;
function cheng(a1,b1:string):string;
var
i,j,h:integer;
x:array[0..255] of integer;
c:string;
begin
fillchar(x,sizeof(x),0);
for i:=1 to length(a1) do
begin
h:=ord(a1[i])-48;
for j:=1 to length(b1) do
x:=x+h*(ord(b1[j])-48);
end;
c:='';
for i:=length(a1)+length(b1)-1 downto 1 do
begin
x:=x+x[i] div 10;
c:=chr(x[i] mod 10+48)+c;
end;
while x[0]>0 do
begin
c:=chr(x[0] mod 10+48)+c;
x[0]:=x[0] div 10;
end;
cheng:=c;
end;
begin while not eof do
begin
readln(n,m);
for i:=1 to n do
f:='1';
for i:=2 to n do
for j:=2 to m do
begin
str(j,ss);
f:=jia(f,cheng(f,ss));
end;
writeln(f[n,m]);
end;
end.