| ||||||||||
| 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 | |||||||||
Re:改后代码...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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator