Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:你的代码好挤,而且有废话.帮你改了改

Posted by zjut020 at 2008-11-11 22:56:52 on Problem 2603
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: