zoukankan      html  css  js  c++  java
  • Luogu1088 火星人 (康托展开)

    皮一波

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <cmath>
    #define R(a,b,c) for(register int  a = (b); a <= (c); ++ a)
    #define nR(a,b,c) for(register int  a = (b); a >= (c); -- a)
    #define Max(a,b) ((a) > (b) ? (a) : (b))
    #define Min(a,b) ((a) < (b) ? (a) : (b))
    #define Fill(a,b) memset(a, b, sizeof(a))
    #define Abs(a) ((a) < 0 ? -(a) : (a))
    #define Swap(a,b) a^=b^=a^=b
    #define ll long long
    
    #define ON_DEBUG
    
    #ifdef ON_DEBUG
    
    #define D_e_Line printf("
    
    ----------
    
    ")
    #define D_e(x)  cout << #x << " = " << x << endl
    #define Pause() system("pause")
    #define FileOpen() freopen("in.txt","r",stdin);
    
    #else
    
    #define D_e_Line ;
    #define D_e(x)  ;
    #define Pause() ;
    #define FileOpen() ;
    
    #endif
    
    struct ios{
        template<typename ATP>ios& operator >> (ATP &x){
            x = 0; int f = 1; char c;
            for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-')  f = -1;
            while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
            x*= f;
            return *this;
        }
    }io;
    using namespace std;
    
    int a[10007];
    int main(){
    	int n, m;
    	io >> n >> m;
        R(i,1,n){
        	io >> a[i];
        }
        while(m--){
        	next_permutation(a + 1, a + n + 1);
        }
        R(i,1,n){
        	printf("%d ", a[i]);
        }
        
        return 0;
    }
    

  • 相关阅读:
    四、系统开发和运行知识(二)
    9.Parameters
    7.Constants and Fields
    四、系统开发和运行知识(一)
    三、操作系统知识(3)
    6.Type and Member Basics
    三、操作系统知识(2)
    5.Primitive, Reference, and Value Types
    4、Type fundamentals
    三、操作系统知识(1)
  • 原文地址:https://www.cnblogs.com/bingoyes/p/11230689.html
Copyright © 2011-2022 走看看