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 799098386 at 2012-07-18 15:52:47 on Problem 2603
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int m,n=1;
    int i,j,k;
    int a[10006];
    for(i=0;i<10006;i++)
     a[i]=1;
    for(i=0;i<10;i++)
    {
     scanf("%d",&m);
  
       for(j=2;m!=1;j++)
        {
        while(m%j==0)
           {
           
             a[j]=a[j]+1;
             m=m/j;
            
          }
          
        }
    }
    for(i=0;i<10006;i++)
    
      if(a[i]!=1)
        n=n*a[i];
    printf("%d\n",n%10);
       // system("pause");
}

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