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

想问一下这个为什么会wa……

Posted by juventus at 2008-07-18 00:29:40 on Problem 3604
#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:
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