Poj Solution 2603

http://poj.org/problem?id=2603

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int x,i,n=10;int a[10002];a[1]=0;memset(a,0,sizeof(a));
while(n--)
{
  
   scanf("%d",&x);
   for(i=2;x!=1;i++)
   {
    while(x%i==0&&x!=1)
    {
     a[i]++;x/=i;
    }
    if(x==1)
     break;
   }
}
x=1;
for(i=2;i<10000;i++)
{
   if(a[i]!=0)
   {
    x=x*(1+a[i])%10;
   }
}
printf("%dn",x);
return 0;
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *