zoukankan      html  css  js  c++  java
  • 老子的全排列呢

    链接:https://www.nowcoder.com/acm/contest/76/H
    来源:牛客网

    老子的全排列呢
    时间限制:C/C++ 1秒,其他语言2秒
    空间限制:C/C++ 32768K,其他语言65536K
    64bit IO Format: %lld

    题目描述

    老李见和尚赢了自己的酒,但是自己还舍不得,所以就耍起了赖皮,对和尚说,光武不行,再来点文的,你给我说出来1-8的全排序,我就让你喝,这次绝不耍你,你能帮帮和尚么?

    输入描述:

    输出描述:

    1~8的全排列,按照全排列的顺序输出,每行结尾无空格。
    示例1

    输入

    No_Input

    输出

    Full arrangement of 1~8

    备注:

    1~3的全排列  :
    1 2 3
    1 3 2
    2 1 3
    2 3 1
    3 1 2
    3 2 1

    AC代码:
    #include<iostream>
    #include<algorithm>
    using namespace std;
    void permutation(char* str, int length)
    {
        sort(str, str + length);
        do
        {
            int i;
            for (i = 0; i<length-1; i++)
                cout << str[i]<<" ";
            cout << str[i] << endl;
        } while (next_permutation(str, str + length));
    }
    int main()
    {
        char str[] = "12345678";
        permutation(str, 8);
        system("pause");
        return 0;
    }

    今天也是元气满满的一天!good luck!

  • 相关阅读:
    __str__
    __call__
    私有成员
    @property
    静态方法
    静态字段
    cut qcut
    hive 函数大全
    sklearn 中的Countvectorizer/TfidfVectorizer保留长度小于2的字符方法
    numpy教程:随机数模块numpy.random
  • 原文地址:https://www.cnblogs.com/cattree/p/8511208.html
Copyright © 2011-2022 走看看