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 xcl119xcl at 2007-07-29 09:55:17 on Problem 1833
In Reply To:太ft了,竟然真的是用iostream导致超时的,打击了,直接郁闷啊! Posted by:lianxi at 2005-09-20 14:53:18
又学到一课了!呵呵
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	int line;
	int num[1024]={0};
	int n,k;
	cin>>line;
	while(line>0)
	{
		cin>>n>>k;
		for(int i=0;i<n;i++)
			//cin>>num[i];
			scanf("%d",&num[i]);
		while(k>0)
		{
			k--;
			next_permutation(num,num+n);
		}
		for(int j=0;j<n;j++)
		printf("%d ",num[j]);
		cout<<endl;
		line--;
	}
	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