随笔分类 - 暴力枚举
暴力出奇迹
摘要:题目链接 https://www.luogu.com.cn/problem/P1088 题解 方法一:20分,暴力枚举,把所有情况列出,找到给出的手势,往后数m个即为答案 #include<bits/stdc++.h> using namespace std; const int maxN=1001
阅读全文
摘要:题目链接 P1157 组合的输出 题解 #include<bits/stdc++.h> using namespace std; int n, r; int ans[25]; int vis[25]; void dfs(int dep){ if(dep==r+1){ for(int i=1; i<d
阅读全文
摘要:集合的概念 写法一: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int u; 4 int n, a[10]; 5 int main() 6 { 7 cin>>n; 8 for(int i=0; i<n; i++) 9 cin>>a[i];
阅读全文
摘要:问题一:题意:输入一个整数n(n <= 9),输出1、2、3、······、n这n个数的全排列(按照字典序输出)。 方法1:暴力写法 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n=3, a[20];/
阅读全文