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

不用 %100000 吧?

Posted by hengwang70 at 2019-05-25 06:03:21 on Problem 1604
#include    <stdio.h>

int main() {
    int     i;
    int     n, m, f;

    while (scanf("%d", &n) != EOF) {
        f = 1;
        for (i = 1; i <= n; i++) {
            m = i;
            while (m%5 == 0) {
                f = f%4 ? (f+10)/2 : f/2;
                m /= 5;
            }
            f = (f * m) % 10;
        }
        printf("%5d -> %d\n", n, f);
    }
    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