Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
输出约数个数的最后一位(附代码)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator