简单递推(递推式真不想写了),但是要高精加。
结果没有1A。。。蒟蒻啊。。。
要写高精加,突然想到Pascal的高深之处,既可以定义operator,还可以写class,而且自带unit AVLtree!!!
(↑其实就是凑字数的)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 /************************************************************** 2 Problem: 1655 3 User: rausen 4 Language: Pascal 5 Result: Accepted 6 Time:56 ms 7 Memory:708 kb 8 ****************************************************************/ 9 10 uses math; 11 12 type 13 num = array[0..50] of longint; 14 15 var 16 f : array[0..1500] of num; 17 n, k, i, j : longint; 18 19 operator + (const a : num; const b : num) c : num; 20 var 21 i : longint; 22 23 begin 24 fillchar(c, sizeof(c), 0); 25 c[0] := max(a[0], b[0]) + 1; 26 for i := 1 to c[0] do begin 27 c[i] := c[i] + a[i] + b[i]; 28 c[i + 1] := c[i] div 10; 29 c[i] := c[i] mod 10; 30 end; 31 while c[c[0]] = 0 do dec(c[0]); 32 end; 33 34 begin 35 readln(n, k); 36 f[0, 0] := 1; 37 f[0, 1] := 1; 38 for i := 1 to k do 39 for j := i to n do 40 f[j] := f[j] + f[j - i]; 41 for i := f[j, 0] downto 1 do 42 write(f[j, i]); 43 writeln; 44 end.
(最近只会做沙茶题,请见谅>.<)