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 snoopy at 2006-05-29 01:00:42 on Problem 2603
自己真的是没救了...就是把从a1到a10全部分解质因数,然后所有质因数+1相乘,不停的%10

我做法是跟筛素数一样,从2开始,判断每个素数因子有多少,然后+1*现在的答案,因为只考虑最后一位,那么不停的%10

#include <stdio.h>

int i,k,n,j,s[12];

int main()
{
    n=1;
    for(i=0;i<10;i++) scanf("%d",&s[i]);
    for(i=2;i<100;i++)
    {
        k=0;
        for(j=0;j<10;j++)
        {
            while(s[j]%i==0)
            {
                k++;
                s[j]/=i;
            }
        }
        n=(n*k+n)%10;
    }
    k=0;
    for(j=0;j<10;j++)
        if(s[j]>1) k++;
    n=(n*k+n)%10;
    printf("%d\n",n);
    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