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:一个语句就决定是0ms 还是 tle

Posted by 117474335 at 2010-09-28 17:07:20 on Problem 1942
In Reply To:一个语句就决定是0ms 还是 tle Posted by:117474335 at 2010-09-28 17:06:40
#include <stdio.h>
#include <stdlib.h>

__int64 n, m ;

__int64 C ()
{
    __int64 i, t = 1 , j = 2 ;
    n = m - n < n? m - n : n ; // 就是这句话 ;
    for (i = m; i > m - n ; i -- ){
        t *= i ;
        while (t % j == 0 && j <= n){
            t /= j ;
            j ++ ;}}
    return t ;
}

main ()
{
    while (scanf ("%I64d%I64d", &n, &m ) , n | m){ 
        m += n; 
        printf ("%I64d\n", C () ) ;}
}

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