Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
WA???#include <iostream> using namespace std; bool b[1000]; int main() { int i,j,m,n,mul; while(cin>>m>>n&&m) { if(n>m/2)n=m-n; if(n==0)cout<<1<<endl; else { mul=1; memset(b,false,sizeof(b)); for(i=m;i>=m-n+1;i--) { mul*=i; for(j=2;j<=n;j++) { if(!b[j]&&mul%j==0) { mul/=j; b[j]=true; } } } cout<<mul<<endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator