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

终于搞定,虽然做完感觉简单但还是收获不少。

Posted by zpdlut at 2010-09-14 21:24:35 on Problem 1338
#include<iostream>
using namespace std;
int min(int a,int b,int c)
{
	int m;
	if(a>=b)
		m = b;
	else
		m=a;
	if(m>=c)
		m=c;
	return m;
}
int main()
{
	int set[1505];
	set[1] = 1;
	int t1=1;
	int t2=1;
	int t3=1;
	for(int i=2;i<=1500;i++)
	{
		int temp = min(set[t1]*2,set[t2]*3,set[t3]*5);
		if(temp == set[t1]*2)
			t1++;
		if(temp == set[t2]*3)
			t2++;
		if(temp == set[t3]*5)
			t3++;
		set[i] = temp;
	}
	int nums;
	while(cin>>nums&&nums)
	{
		cout<<set[nums]<<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