#include <iostream> #include<stdio.h> using namespace std; int main() { int r,n,ans,t; scanf("%d%d",&n,&r); if(n-r<r) r=n-r; ans = n; n=n-1; t=2; while(t<=r) { ans=ans*n/t; n--; t++; } printf("%d ",ans); return 0; }
#include <iostream> #include<stdio.h> using namespace std; int main() { int r,n,ans,t; scanf("%d%d",&n,&r); if(n-r<r) r=n-r; ans = n; n=n-1; t=2; while(t<=r) { ans=ans*n/t; n--; t++; } printf("%d ",ans); return 0; }