|
|
back to boardWhy my programm does not work? Help, me please. var n,k,i:byte;s:longint; function step(x,y:byte):longint; var i:byte;s:longint; begin s:=1; For i:=1 to y do s:=s*x; step:=s; end; function f(x:byte):longint; var i:byte;s:longint; begin s:=1; for i:=2 to x do s:=s*i; f:=s; end; Function c(n,k:byte):longint; begin c:=f(n) div f(k) div f(n-k); end; begin s:=0; readln(n); readln(k); n:=n-1; for i:=0 to round(n/2) do s:=s+c(n+1-i,i)*step(k-1,n-i); writeln(s*(k-1)); end. |
|
|