- 全排列
- 2016-05-11 20:55:42 @
评测结果
编译成功
测试数据 #0: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 556 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 556 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #4: Accepted, time = 593 ms, mem = 556 KiB, score = 10
测试数据 #5: TimeLimitExceeded, time = 1015 ms, mem = 548 KiB, score = 0
测试数据 #6: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #7: TimeLimitExceeded, time = 1015 ms, mem = 548 KiB, score = 0
TimeLimitExceeded, time = 2638 ms, mem = 560 KiB, score = 60
代码
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,now,a[25];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++) a[i]=i;
do
{
now++;
if(now==m)
{
for(int i=1;i<=n;i++) cout<<a[i]<<' ';
return 0;
}
}while(next_permutation(a+1,a+n+1));
return 0;
}
2 条评论
-
frankchenfu LV 8 @ 2017-01-19 21:22:51
##这道题目主要是靠康托展开
-
2016-07-27 11:37:24@
这个是STL
- 1