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 2005-12-08 11:01:03 on Problem 2720
In Reply To:就是四川大学上的那个power and power again吧..不过我的方法比较慢... Posted by:achilles at 2005-12-08 01:00:23
llong f(llong a, llong n, llong m)
{
    if (m == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return a % m;
    }
    int e = euler( m );
    int nn = f(a, n-1, e);
    if (nn == 0) nn = e;
    return mod_pow(a, nn, m);
}

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