观察可得,最大的拆分方法是尽量拆成3,特殊的,如果最后剩下了1,那么就把3+1变成2+2
然后高精度计算即可
var s2,s3,i,n,l:longint;
a:array[..] of longint; procedure mul(x,m:longint);
var i,j,c,y:longint;
begin
for i:= to m do
begin
inc(l);
c:=;
for j:= to l do
begin
y:=a[j]*x+c;
c:=y div ;
a[j]:=y mod ;
end;
while a[l]= do dec(l);
end;
end; begin
readln(n);
if n mod = then s3:=n div
else if n mod = then
begin
s3:=(n-) div ;
s2:=;
end
else if n mod = then
begin
s3:=(n-) div ;
s2:=;
end;
a[]:=;
l:=;
mul(,s3);
mul(,s2);
writeln(l);
for i:=l downto l- do
begin
if i<= then break;
write(a[i]);
end;
writeln;
end.