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

Re:0ms STL 一次AC 爽!

Posted by palqing at 2010-11-18 17:43:07 on Problem 1338
In Reply To:Re:0ms STL 一次AC 爽! Posted by:palqing at 2010-11-18 17:42:53
#include<iostream>
#include<set>
#include<vector>
using namespace std;
int main()
{
	set<int> sts;
	sts.insert(1);
	int n;
	set<int>::iterator it=sts.begin();
	for(int i=1;i!=1300;i++)
	{
		n=*it;
		sts.insert(n*2);
		sts.insert(n*3);
		sts.insert(n*5);
		++it;
	}
	vector<int> vec(sts.begin(),sts.end());
	int num;
	while(cin>>num)
	{
		if(num==0) break;
		cout<<vec[num-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