| ||||||||||
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 |
3421怎么回runtime error ???#include <cstdio> #include <string> #define Max 1024*1024 int pre[Max+1]; void prem() { int j; for(int i=2;i*i<=Max;i++) { if(!pre[i]) { j=i*i; while(j<=Max) {pre[j]=1;j=j+i; } } } } int fac(int i) { int k=1; for(int j=1;j<=i;j++) k*=j; return k; } int main() { prem(); int a[21]; long n; while(scanf("%d",&n)==1) { memset(a,0,sizeof(a)); int i,t=1,sum=0; for(i=2;i<=Max;i++) if(!pre[i]) { if(n%i==0) t++; while(n%i==0) { n=n/i; a[t]++; sum++; } } i=1; int temp=fac(sum); while(i<=sum) { if(a[i]!=0) temp/=fac(a[i]); i++; } printf("%d% d%\n",sum,temp); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator