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

210是ugly number吗?

Posted by frkstyc at 2005-03-24 01:15:43 on Problem 1338
In Reply To:救救我!wa Posted by:zhaohuazhaoshi at 2005-03-24 00:59:34
> #include<iostream.h>
> void main()
> {
> 	int a[2000];
> 	int i,j=1,b;
> 	a[0]=1;
> 	for(i=1;i<2000;i++)
> 	{
> 		if((j%2==0)||(j%3==0)||(j%5==0))
> 			a[i]=j;
> 		else i--;
> 		j++;
> 	}
> 	//for(i=0;i<1500;i++)
> 	//	cout<<"  "<<a[i];
> 	while(1)
> 	{
> 		cin>>b;
> 		if(b==0)
> 			break;
> 		else cout<<a[b-1]<<endl;
> 	}
> }
>   

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