![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
#暴力枚举
102101141高孙炜
这个作者很懒,什么都没留下…
展开
-
暴力枚举 洛谷1149 火柴棒等式
目录题目描述:输入输出示范:源代码:分析思路:题目描述:输入输出示范:源代码:#include<iostream>#include<string.h>using namespace std;const int num[10] = { 6,2,5,5,4,5,6,3,7,6 };//十个数字要用到的火柴棒根数,下标表原数字bool tag[111];int total = 4;//总用去火柴棒void...原创 2021-10-12 20:26:20 · 120 阅读 · 0 评论 -
暴力枚举 洛谷3392 涂国旗
目录题目描述:输入输出格式:输入输出样例:源代码:分析思路:题目描述:输入输出格式:输入输出样例:源代码:#include<iostream>#include<string>#include<algorithm>using namespace std;string flag[50];int main(){ int n, m; cin >> n >> m...原创 2021-10-09 19:34:17 · 244 阅读 · 0 评论 -
暴力枚举 洛谷1088 火星人
源代码:#include<iostream>#include<algorithm>using namespace std;int a[10001];int main(){ int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) cin >> a[i]; while (m--) next_permutation(a + 1, a + n + 1); ...原创 2021-10-09 18:34:34 · 124 阅读 · 0 评论 -
暴力枚举 洛谷1706 全排列问题
目录源代码:分析思路:源代码:#include<iostream>#include<algorithm>using namespace std;int a[10];int main(){ int n; cin >> n; for (int i = 1; i <= n; ++i) a[i] = i; do { for (int i = 1; i <= n; ++i) printf("%5d",.原创 2021-10-09 17:10:17 · 312 阅读 · 0 评论 -
暴力枚举 洛谷1157
源代码:#include<iostream>using namespace std;int a[22];int main(){ int n, r; cin >> n >> r; for (int S = (1 << n) - 1; S >= 0; S--) { int cnt = 0; for (int i = 0; i < n; ++i) { if (S&(1 << i))...原创 2021-10-09 16:23:29 · 114 阅读 · 0 评论 -
暴力枚举 洛谷1036 选数
源代码:#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>using namespace std;bool check(int x)//检查一个数字是否是素数{ if (x == 2) return 1; for (int i = 2; i <= sqrt(x); ++i) { if (!(x%i)) return 0; }...原创 2021-10-08 20:40:25 · 125 阅读 · 0 评论 -
暴力枚举题 洛谷2089 烤鸡
题目背景猪猪 Hanke 得到了一只鸡。题目描述猪猪 Hanke 特别喜欢吃烤鸡(本是同畜牲,相煎何太急!)Hanke 吃鸡很特别,为什么特别呢?因为他有1010种配料(芥末、孜然等),每种配料可以放11到33克,任意烤鸡的美味程度为所有配料质量之和。现在, Hanke 想要知道,如果给你一个美味程度nn,请输出这1010种配料的所有搭配方案。输入格式一个正整数nn,表示美味程度。输出格式第一行,方案总数。第二行至结束,1010个数,表示每种配料所...原创 2021-10-07 19:45:35 · 243 阅读 · 0 评论