[[komb]]
 

http://kmlinux/~culik/wiki

#include <iostream>
#include <iomanip>
 
using namespace std;
 
const int M = 10;
int p [M][M];
 
int main ()
{
    for (int i = 0; i < M; i++)
    {
        for (int j = 0; j < M; j++)
        {
           p[i][j] = 0;
        }
    }
 
    p[0][0] = 1;
    for (int n = 1; n < M; n++)
    {
        p[n][0] = 1;
        p[n][n] = 1;
        for (int k = 1; k < n; k++)
        {
            p[n][k] = p[n-1][k-1] + p[n-1][k];
        }
    }
 
 
   for (int n = 0; n < M; n++)
   {
       for (int k = 0; k <= n; k++)
       {
           cout << p[n][k] << " ";
       }
       cout << endl;
   }
 
  return 0;
}
 
komb.txt · Last modified: 2018/10/11 15:19 by 147.32.8.115
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki