PersonalCorpus 版 (精华区)

Your C++ program has solved Ok the problem 568 (Just the Facts)
in 0.000 seconds with low memory spent.


void main()
{
    int i,j,k,n,m;
    while (scanf("%d\n",&n)==1) {
        k=n/5+n/25+n/125+n/625+n/3125;
        i=1;
        for (j=2;j<=n;j++) {
            m=j;
            while ((k>0)&&(m%2==0)) {
                m/=2; k--;
            }
            while (m%5==0) m/=5;
            i*=m;
            i%=10;
        }
        printf("%5d -> %d\n",n,i);
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.776毫秒