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:改后代码...

Posted by mayp at 2007-03-16 14:01:20 on Problem 2603
In Reply To:怎么老错了? Posted by:acm_bug at 2006-10-04 09:02:21
#include<iostream>
using namespace std;
int b[10000];
int main()
{
    int a,c,i;
    memset(b,0,10000);
    for(i=0;i<10;++i)
    {
       cin>>c;  a=c;
       if(a==2)b[2]++;
       else if(a==3)b[3]++;
       else if(a>=4)
       for(int j=2;j<=c;++j)
       {
            
            while((a%j)==0)
            {a/=j;b[j]++;}
            if(a==1)break;
       }
    }
    int num=1;
    for(i=0;i<10000;++i)
    {if(b[i]) num*=(b[i]+1);num%=10;}
    cout<<num<<endl;
    getchar();
    return 0;
}
貌似这个程序G++编译效率会高些...

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