Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我彻底疯了,救命,高手看看下面这个程序哪里有问题,我总是WA,谁提供一组测试数据呀

Posted by jxnuxiaoyong at 2009-01-17 19:41:32 on Problem 2249
#include <stdio.h>

main()
{
    __int64 n,k,a,i;
    while(1)
    {
        scanf("%I64d%I64d",&n,&k);
        if(n==0&&k==0)  break;
        if(k==0||k==n) printf("1\n");
        else
        {
            if(n-k<k) k=n-k;
            a=n;
            for(i=k;i>1;i--)
                a=a*(n-i+1)/(k-i+2);
            printf("%I64d\n",a);
        }
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator