Advertisement
Guest User

Untitled

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