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:fbixiaozc135 at 2007-08-24 00:08:38 > #include<iostream> > using namespace std; > > const MAX = 10000; > int prime_set[MAX]; > int main() > { > int a,x,i; > > fill_n(prime_set, MAX, 0); > > for(i = 0; i < 10; ++i) > { > cin >>x; > a = x; > if (a == 1) > continue; > else > for (int j = 2; j <= x; ++j) > { > > while ( (a % j) == 0 )//相当于是筛选法求素数 > { > a /= j; > ++prime_set[j]; > } > if (a == 1) > break; > } > } > > int last = 1; > for (i = 0; i < MAX; ++i) > { > if (prime_set[i]) > last *= (prime_set[i] + 1); > last %= 10; > } > > cout << last << endl; > > return 0; > } 你的代码好散。。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator