首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
奶龙大王
2026年3月19日 14:59
全排列 题解:
P1185
回复 0
|
赞 1
|
浏览 30
if和for对于递归全排列的选择 #include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; void dfs(string& s, vector<bool>& used, string& path) { if (path.size() == s.size()) { &nb...
yauqq
2026年3月18日 19:14
全排列 题解:
P1185
回复 0
|
赞 1
|
浏览 27
#include<bits/stdc++.h> using namespace std; int main(){ string str; cin >> str; do{ cout << str << endl; }while(next_permutation(str.begin(),str.end())); return 0; }
lllyf
2026年3月17日 22:18
全排列 题解:可以加一个排序搞定大小顺序
P1185
回复 0
|
赞 2
|
浏览 41
#include <iostream> #include <queue> #include <vector> #include<string> #include<set> #include<stack> #include<cstring> using namespace std; int v[10]; int u[10]; char w[10]; void g(int s,int n){ if(s==n){ &nbs...
bro
2026年3月9日 01:25
全排列 题解:c++
P1185
回复 0
|
赞 19
|
浏览 261
#include <bits/stdc++.h> using namespace std; char path[8]; int visited[8]; string str; int num; void dfs(int step){ if(step == num){ for(int i = 0 ; i < num ; i++){ cout << path[i]; &nb...
bro
2026年3月8日 14:54
全排列 题解:c++
P1185
回复 0
|
赞 0
|
浏览 67
#include <bits/stdc++.h> using namespace std; int main(){ string str; while(cin >> str){ do { cout << str << endl; } while (next_permutati...
uly
2026年3月7日 13:25
全排列 题解:全排列递归法
P1185
回复 0
|
赞 15
|
浏览 194
#include <bits/stdc++.h> using namespace std; void method(string s,string result) { if (s.length() ==0) { cout<<result<<endl; return; } for (int i = 0; i < s.length(); i++) { // 跳过重复字符(如果已排序) if (i > 0 && s[...
Ranz
2026年3月3日 23:21
全排列 题解:
P1185
回复 0
|
赞 0
|
浏览 108
使用next_permutation函数实现 #include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin >> s){ do{ cout << s << endl;...
mlx
2026年2月9日 10:22
全排列 题解:
P1185
回复 0
|
赞 7
|
浏览 292
#include<iostream> using namespace std; const int N=10; bool path[N]; string str; char s[N]; void dfs(int u) { if(u==str.size()) { cout<<s<<endl; return; } for(int i=0;i<str.size();i++) { if(!path[i]) { s[u]=str[i]; path[i]=true; ...
jqt
2025年9月3日 17:03
全排列 题解:
P1185
回复 0
|
赞 5
|
浏览 888
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; do{ cout<<s<<endl; } while(next_permutation(s.begin(),s.e...
路西法
2025年3月25日 16:57
全排列 题解:借用next_permutation函数
P1185
回复 0
|
赞 12
|
浏览 1.3k
提前打印一个本身 #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int main(){ char a[10]; gets(a); int n=strlen(a); string str1=a; printf("%s\n&...
1
2
3
4
题目
全排列
题解数量
32
发布题解
在线答疑
热门题解
1
全排列 题解:DFS自用笔记,带详细注释
2
全排列 调用C++库函数
3
全排列 题解:新手易于理解模板(B站视频套用)
4
全排列 题解:全排列数字,用数字做索引
5
全排列 题解:递归
6
全排列 题解:c++
7
全排列 题解:
8
全排列 题解:全排列递归法
9
全排列(dfs搜索) 题解:
10
全排列 题解:借用next_permutation函数