Advertisement
agul

Untitled

Jul 1st, 2011
2,503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.34 KB | None | 0 0
  1. const
  2.     kk=3;
  3.     a:array[1..kk] of longint=(1,2,6);
  4.  
  5. var
  6.     n,i,j:longint;
  7.     f:array[-10..110,0..kk] of longint;
  8.  
  9. begin
  10. reset(input,'input.txt');
  11. rewrite(output,'output.txt');
  12. fillchar(f,sizeof(f),0);
  13. read(n);
  14. for i:=0 to kk do
  15.     f[0][i]:=1;
  16. for i:=1 to n do
  17.     for j:=1 to kk do
  18.             f[i][j]:=f[i-a[j]][j]+f[i][j-1];
  19. write(f[n][kk]);
  20. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement