Commit a7edf423 authored by David Rothbauer's avatar David Rothbauer :speech_balloon:
Browse files

Add new file

parents
No related merge requests found
Pipeline #1281 failed with stages
Showing with 36 additions and 0 deletions
+36 -0
mapaI.cpp 0 → 100644
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int x, y; //rozmery mrizky
int faktorial(int cislo) { //rekuzivni funkce pro vypocet faktorialu
if (cislo >= 1) {
return cislo * faktorial(cislo - 1);
}
else {
return 1;
}
}
int vypocet(int a, int b) {
if (a == 0) { //kvuli indexum od 0 se zde pripadne pricte 1
a = 1;
}
if (b == 0) {
b = 1;
}
int m = faktorial(a + b); //vzorec z kombinatoriky z internetu
int n = faktorial(a) * faktorial(b);
return m/n;
}
int main()
{
cin >> x >> y; //precteni rozmeru od uzivatele
cout << vypocet(x-1,y-1); //zavolani funkce s parametry od uzivatele
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment