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
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

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:

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