Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int licz(int n, int k)
- {
- int tab[n][k];
- for (int i=0;i<n;i++)
- {
- for (int j=0;j<k;j++)
- {
- if (i==0)
- tab[i][j]=j;
- if (j==0)
- tab[i][j]=2*i;
- else
- tab[i][j]=tab[i][j-1]+3*(tab[i-1][j]);
- }
- }
- return tab[n][k];
- }
- int main()
- {
- int n=3;
- int k=3;
- cout << licz(n,k);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement