Advertisement
kxcoze

lab22_11_2

Sep 9th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>            
  2.            
  3. using namespace std;            
  4.      
  5. int factor(int n) {    
  6.     int sum = 1;    
  7.     for (int i = 1; i < n; i++) {    
  8.         sum += i * sum;    
  9.     }    
  10.     return sum;    
  11. }    
  12.    
  13. int main() {            
  14.     int c, n, m;    
  15.     cout << "Введите кол-во человек: ";    
  16.     cin >> m;    
  17.    
  18.     cout << "Введите кол-во кандитатов: ";    
  19.     cin >> n;    
  20.    
  21.     cout << "Способов отобрать команду в составе " << m << " человек из " << n << " кандитатов: " << factor(n) / factor(m) * factor(n-m);        
  22.     return 0;        
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement