比赛 20111111 评测结果 AAAAAAAAAA
题目名称 最优分解方案 最终得分 100
用户昵称 Des. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-11-11 08:34:55
显示代码纯文本
program best;
type arr=array[1..1000]of integer;
var a:array[1..1000]of integer;
    g:text;
    c:arr;
    t,k,m,n,j,x:longint;
    s:string;
procedure mul(a:arr;s:string);
var b:arr;
    j,t,k,y:longint;
begin
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
y:=0;
for t:=length(s) downto 1 do
  begin
    inc(y);
    b[y]:=ord(s[t])-48;
  end;
for t:=1 to x do
  for k:=1 to y do
    begin
      c[t+k-1]:=c[t+k-1]+a[t]*b[k];
      if c[t+k-1]>9 then
        begin
          c[t+k]:=c[t+k-1]div 10+c[t+k];
          c[t+k-1]:=c[t+k-1] mod 10;
        end;
    end;
if c[t+k]>0 then x:=t+k else x:=t+k-1;
end;
begin
assign(input,'best.in');
reset(input);
assign(output,'best.out');
rewrite(output);
readln(n);
for t:=2 to 60 do
  begin
    n:=n-t;
    inc(m);
    a[m]:=t;
    if n<t+1 then break;
  end;
if n=t then
  begin
    for t:=1 to m do inc(a[t]);
    inc(a[m]);
  end
else for t:=m downto m-n+1 do
       inc(a[t]);
c[1]:=1;
x:=1;
for t:=1 to m do
  begin
    str(a[t],s);
    mul(c,s);
  end;
for t:=x downto 1 do
  write(c[t]);
writeln;
close(output);
end.