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

Re:大牛帮看下 为什么WR了

Posted by luxinpeng at 2008-10-19 10:31:02 on Problem 3604
In Reply To:大牛帮看下 为什么WR了 Posted by:luxinpeng at 2008-10-18 20:51:58
> #include <stdio.h>
> #include <string.h>
> #include <math.h>
> int n;
> const int nn=3000;
> int prime[nn];
> int is[nn];
> void make_prime(int nn)
> {
> 	int i,j,b;
> 	memset(is,1,sizeof(is));
> 	is[0]=is[1]=0;
> 	prime[0]=0;
> 	for(i=2;i<=nn;i++)
> 	{
> 		if(is[i]==0) continue;
> 		prime[++prime[0]]=i;
> 		b=nn/i;
> 		for(j=i;j<=b;j++)
> 		is[i*j]=0;
> 		
> 	}
> }
> void slove()
> {
>     int i,j,t,k,t1;;
>     t=1;
> 	for(i=1;i<=prime[0]&&prime[i]*prime[i]<=n;i++)
> 	{
> 		
> 		while(n%prime[i]==0)
> 		{
> 			k=0;
> 			while(n%prime[i]==0)
> 			{
> 				if(n==1) break;
> 				k++;
> 				n=n/prime[i];
> 			}
> 			t1=(k+1)*(k+2)/2;
> 			t*=t1*t1;
> 		}
> 	}
> 	if(n>1) t*=9;
> 	printf("%d\n",t);	
> }
> int main()
> {
> 	int t;
> 	make_prime(nn);
> 	//printf("%d\n",prime[0]);
> 	scanf("%d",&t);
> 	while(t--){
> 	scanf("%d",&n);
> 	if(n==1) printf("1\n");
> 	else slove();
> 	}
> 	return 0;
> }

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