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

Re:用double不行啊,谁用double AC了 给我看看?

Posted by from0_poj at 2013-10-18 20:44:11 on Problem 2249
In Reply To:用double不行啊,谁用double AC了 给我看看? Posted by:hongxingxiaonan at 2012-06-11 17:20:28
给你看看。


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,k,i;
    double sum;

    while(scanf("%d%d",&n,&k),n)
    {
        sum=1;
        if(k>(n>>1))
            k=n-k;
        for(i=k;i>=1;i--,n--)
            sum*=(n*1.0/i);
        printf("%.0f\n", sum);
    }

    return 0;
}

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