ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1402. Cocktails

what's wrong with my code?
Posted by yungyBaSe 26 Dec 2018 20:48
#include <iostream>
#include <cmath>
using namespace std;
int fac(int n){
    if (n==0){
        return 1;
    }
    else {
        return n*fac(n-1);
    }
}
int wtf(int n,int k){
    return fac(n)/fac(n-k);
}
int cock(int n){
    int sum;
    for (int i=2;i<=n;i++){
        sum += wtf(n,i);
    }
    return sum;
}
int main()
{
    int n;
    cin >> n;
    cout << cock(n);
    return 0;
}