long long choose(int n, int k) {
if (k > n) return 0;
if (k * 2 > n) k = n - k;
if (k == 0) return 1;
long long result = n;
for (int i = 2; i <= k; i++) {
result *= (n - i + 1);
result /= i;
}
return result;
}
-
Notifications
You must be signed in to change notification settings - Fork 1
jhonnold/kattis-problems
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Releases
No releases published