| ||||||||||
| 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 | |||||||||
Re:你写错了.In Reply To:程序改成这样还说错误的啊,wr Posted by:382784268 at 2008-11-29 16:32:12 #include <iostream>
using namespace std;
int main()
{
int n, k;
cin>>n>>k;
while((n!=0) || (k!=0))
{
if((n==k) || (k==0))
cout<<1<<endl;
else
{
if(k>n/2)
k=n-k;
long long int result=1;
for(int i=1; i<=k; i++)
{
result=result*n;
n--;
result=result/i;
}
cout<<result<<endl;
}
cin>>n>>k;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator