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

我是这样搞地~~

Posted by achilles at 2004-08-30 17:35:48 on Problem 1811
llong is_prime(llong n)
{
    llong old = n;
    if (n%2 == 0)
        return 2;
        
    llong limit = llong(sqrt(n*1.0)) + 1;
    if (limit%2 == 0)   --limit;

    do{
        if (n%limit == 0)
        {
            n = limit;
            limit = llong(sqrt(n*1.0))+1;
            if (limit%2 == 0) --limit;
        }
        else
            limit -= 2;
    }while (limit >= 3);
    if (old == n)
        return 1;
    else
        return n;
}

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