| ||||||||||
| 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<iostream>
using namespace std;
struct factor
{
int x[2238],y[2238],num,fuck;
} fac;
void decompound(int a)
{
int i,count;
memset(fac.x,0,sizeof(fac.x));
memset(fac.y,0,sizeof(fac.y));
fac.num=0;
if(a==1)
{
fac.num=1;
fac.x[0]=fac.y[0]=1;
return;
}
for(i=2;i*i<=a;i++)
{
count=0;
while(!(a%i))
{
a/=i;
count++;
}
if(count!=0)
{
fac.x[fac.num]=i;
fac.y[fac.num++]=count;
}
}
if(a!=1)
{
fac.x[fac.num]=a;
fac.y[fac.num++]=1;
}
}
int main()
{
int cases;
cin>>cases;
while (cases--)
{
int x,i;
scanf("%d",&x);
/* decompound(x);
cout<<x<<" = "<<fac.x[0]<<"^"<<fac.y[0];
for(i=1;i<fac.num;i++)
cout<<" * "<<fac.x[i]<<"^"<<fac.y[i];
cout<<endl;*/
decompound(x);
__int64 res=1;
for (i=0;i<fac.num;i++)
res*=(fac.y[i]+2)*(fac.y[i]+1)/2;
res=res*res;
printf("%I64d\n",res);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator