Problem : 1027 ( Ignatius and the Princess II ) Judge Status : Accepted
RunId : 6278648 Language : C++ Author : ssun
Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta
#include "iostream"
#include "algorithm"
using namespace std;
int main(){
int arr[1010];
int i,m,n;
while(cin>>n>>m){
for(i=1; i<=n; i++){
arr[i] = i;
}
i = 0;
do{
i++;
if(i==m){
for(int k=1; k<=n; k++){
cout<<arr[k];
if(k == n)
cout<<endl;
else
cout<<" ";
}
}
}while(next_permutation(arr+n-7,arr+n+1));//由于m小于10000,所以从后面第八位开始排列
}
return 0;
}
分享到:
相关推荐
HDU的1250,主要是利用高精度加法,但是代码有点繁琐,效率不是很高
nm where m is the number of integers in the set and n1 ... nm are the integers. All integers will be positive and lie within the range of a 32-bit integer. Output For each problem instance, output a ...
杭电ACMhdu1163
You are given the value of m and (f(n,m)?n)⊕n, where ``⊕’’ denotes the bitwise XOR operation. Please write a program to find the smallest positive integer n that (f(n,m)?n)⊕n=k, or determine it ...
HDU1059的代码
hdu1001解题报告
hdu 1574 passed sorce
HDU的一题........HDU DP动态规
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
hdu2101AC代码
搜索 dfs 解题代码 hdu1241
hdu 5007 Post Robot 字符串枚举。 暴力一下就可以了。
hdu acm 教案 动态规划(1) hdu acm 教案 动态规划(1)
ACM HDU题目分类,我自己总结的大概只有十来个吧
hdu 1166线段树代码
HDU最全ac代码
hdu动态规划算法集锦
自己做的HDU ACM已经AC的题目
hdu题目分类
HDU图论题目分类