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 |
以下是代码,为什么还wa#include "stdio.h" #include "math.h" int pos; int a[10000]; int prime[50000]; bool isPrime(int num) { int i,limit; if((num&1)==0) return false; else { limit=(int)sqrt((double)(num)); for(i=3;i<=limit;i+=2) if(num%i==0) return false; return true; } } int main(void) { int counter=1,i,j,t,m; long long num,temp,result; int k=3; bool tag; m=0; prime[m++]=2; for(k=3;k<100000;isPrime(k)?(prime[m++]=k,k+=2):k+=2); scanf("%d",&t); while(t--) { scanf("%I64d",&num); pos=0; result=1; temp=num*num; for(i=0;temp!=1&&i<m;i++) { tag=true; while(temp%((long long)prime[i])==0) { if(tag) { a[pos]=1; tag=false; } else a[pos]++; temp=temp/((long long)prime[i]); } pos++; } if(i==m&&temp!=1) a[pos++]=1; for(j=0;j<pos;j++) result*=(a[j]+1); result=(result+1)/2; printf("Scenario #%d:\n",counter++); printf("%I64d\n\n",result); } return 0; } 还请高手给些数据,3Q! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator