HDU-1027 组合数 STL-next_permutation
生活随笔
收集整理的這篇文章主要介紹了
HDU-1027 组合数 STL-next_permutation
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題義:給定一個數字串,求出這些串的第K小組合串。
代碼如下:
#include <cstdio> #include <algorithm> using namespace std;int num[1005];int main( ) {int N, M;while( scanf( "%d %d", &N, &M )!= EOF ){for( int i= 1; i<= N; ++i ){num[i]= i;}while( --M ){next_permutation( num+ 1, num+ N+ 1 );}for( int i= 1; i<= N; ++i ){printf( i== N? "%d\n": "%d ", num[i] );}}return 0; }
轉載于:https://www.cnblogs.com/Lyush/archive/2011/08/16/2140570.html
總結
以上是生活随笔為你收集整理的HDU-1027 组合数 STL-next_permutation的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 移动开发网站收集
- 下一篇: INFO:InstallShield工程