这个是正常解法

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<map>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<stack>
using namespace std;
int book[],a[],b[],l;
void dfs(int ka,int ci)
{
int i,j;
if(ci==l)
{
for(i=; i<=l; i++) printf("%d",b[i]);
printf("\n");
return;
}
for(i=ka; i<l; i++)
{
if(!book[i])
{
book[i]=;
b[ci+]=a[i];
dfs(ka,ci+);
book[i]=;
while(i+<l&&a[i]==a[i+]) i++;
}
}
return ;
}
int main()
{
memset(book,,sizeof(book));
int i;
char s[];
scanf("%s",s);
l=strlen(s);
for(i=; i<l; i++) a[i]=s[i]-'';
sort(a,a+l);
dfs(,);
return ;
}

51Nod - 1384 正常解法的更多相关文章

  1. 51Nod - 1384

    全排列函数解法 #include <iostream> #include <cstdio> #include <cstring> #include <cmat ...

  2. 51Nod 1384 全排列

    给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列.例如:S = "1312", 输出为:   1123 1132 1213 1231 131 ...

  3. 51nod 1384:全排列(STL)

    题目链接 记住next_permutation函数的用法,另外string在这里比char[]慢好多啊.. //#include<bits/stdc++.h> //using namesp ...

  4. 51nod 1384 可重集的全排列

    对于1231,121,111等有重复的数据,我们怎么做到生成全排列呢 实际上,对于打标记再释放标记的这种方法,如果一开始第一层递归访问过1那么你再访问 就会完全重复上一次1开头的情况,那么递归地考虑这 ...

  5. 51nod 1165 整边直角三角形的数量(两种解法)

    链接:http://www.51nod.com/Challenge/Problem.html#!#problemId=1165 直角三角形,三条边的长度都是整数.给出周长N,求符合条件的三角形数量. ...

  6. 51nod 2020 排序相减(暴力解法)

    题目: 代码: #include <bits\stdc++.h> using namespace std; int trim(int x){ ]; ;i < ; i++){ a[i] ...

  7. 51nod 1613翻硬币

    题目链接:51nod 1613 翻硬币 知乎上的理论解法http://www.zhihu.com/question/26570175/answer/33312310 本题精髓在于奇偶性讨论. 若 n ...

  8. 51Nod:活动安排问题之二(贪心)

    有若干个活动,第i个开始时间和结束时间是[Si,fi),同一个教室安排的活动之间不能交叠,求要安排所有活动,最少需要几个室? 输入 第一行一个正整数n (n <= 10000)代表活动的个数. ...

  9. 51NOD 1149:Pi的递推式——题解

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1149 F(x) = 1 (0 <= x < 4) F(x) ...

随机推荐

  1. intput/output 文件的复制练习

    import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStrea ...

  2. Linux:使用rpcgen实现64位程序调用32位库函数

    摘要:本文介绍使用rpcgent实现64位程序调用32位库函数的方法,并给出样例代码. 我的问题 我的程序运行在64位Linux系统上,需要使用一个从外部获得的共享库中的函数,这个共享库是32位的,无 ...

  3. makefile编写规则

    cc = g++ -std=c++11 prom = calc deps = FtTest.h obj = FtTest.o newft.o LIBS = -lgtest_c11 $(prom): $ ...

  4. typescript 创建类型

    type long = string | number; type stringObj = { [index: string]: string; } type NumberObj = { [index ...

  5. 关于${pageContext.request.contextPath}的理解 (转载)

    ${pageContext.request.contextPath}是JSP取得绝对路径的方法,等价于<%=request.getContextPath()%> . 也就是取出部署的应用程 ...

  6. utf8 vs utf8mb4

    UTF-8 is a variable-length encoding. In the case of UTF-8, this means that storing one code point re ...

  7. react native出现 undefined is not a function_this4.错误函数无法识别

    该函数可能里可能有this,的上个函数this要绑定bind(this)

  8. 关于npm Vue

    参考:http://www.runoob.com/w3cnote/vue2-start-coding.html 安装vue脚手架 npm install vue-cli -g 查看当前脚手架版本 np ...

  9. 使用 Weinre 调试移动网站

    在 PC 端,我们可以使用 Firebug 或者 Chrome 开发人员工具方便的调试网站或者 Web 应用.但是,当我们想在移动端调试站点或者应用的时候,这些工具就派不上用场了.因此,移动开发人员都 ...

  10. 前端学习历程--js事件监听

    一.事件监听使用场景 1.事件触发多个方法的时候,后一个方法会把前一个方法覆盖掉. window.onload = function(){  var btn = document.getElement ...