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 |
这样s竟然不会溢出 -_-!!In Reply To:我的程序,希望对大家有提示 Posted by:382784268 at 2009-03-06 21:51:51 > #include<iostream> > using namespace std; > int main() > { > int n,k; > while(cin>>n>>k) > { > if(n==0&&k==0) > break; > int i=0; > if(k>n/2) > k=n-k; > int j=k; > __int64 sum=1; > __int64 s=1; > while(i<k) > { > sum*=n; > n--; > i++; > if(sum%j==0) > sum=sum/j; > else > s*=j; > j--; > } > sum/=s; > printf("%I64d\n",sum); > } > return 0; > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator