uva568 Just the Facts

View Code
#include<stdio.h>
#include<string.h>
int main()
{
    int n, i, j, k;
    long long s = 0;
    while(scanf("%d",&n) != EOF)
    {
        printf("%5d -> ", n);
        s = 1;
        for(i = 2;i <= n; i++)
        {
            s *= i;
            while(s%10 == 0)
                s /= 10;
            if(s > 1000000000000)
                s %= 1000000000000;
        }
        printf("%lld\n",s%10);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/SDUTYST/p/2617415.html