![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
暴力求解法
文章平均质量分 77
zzuspy
本人初学者~~
展开
-
POJ - 2965 - The Pilots Brothers' refrigerator (高效贪心!!)
The Pilots Brothers' refrigeratorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 19356 Accepted: 7412 Special JudgeDescriptionThe game “The Pilo原创 2014-12-19 10:46:34 · 1465 阅读 · 0 评论 -
UVA - 10012 - How Big Is It? (枚举)
思路:刚开始以为直接全排列枚举一下就好了,结果WA了。没想到没这么简单,重新排列后还要判断当前情况是否能够成立(这时可能会有相交的)。比如现在有两个大圆中间围着几个很小很小的圆,肯定是两个大圆先相切,中间几个小圆就有空隙了,这就能说通相邻的圆可以不相切而又使得box最小,解决方案是算出当前圆和之前的圆的相对位置取最大值,这样就能够保证既能够最大,又能够不相交AC代码:#includ原创 2015-03-24 19:48:50 · 818 阅读 · 0 评论 -
UVA - 639 - Don't Get Rooked (暴力回溯)
UVA - 639Don't Get RookedTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionIn chess, the rook is a piece that原创 2015-03-23 13:25:27 · 1006 阅读 · 0 评论 -
UVA - 301 - Transportation (暴力回溯)
UVA - 301TransportationTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionRuratania is just entering capitalis原创 2015-03-23 14:40:19 · 744 阅读 · 0 评论 -
UVA - 10125 - Sumsets (暴力枚举 + STL)
思路:刚开始的思路是直接暴力枚举O(n3),感觉会超时,不过还是试着敲了下,居然过了,其中用STL中的set来找最后一个数,最好先排下序,然后再枚举d(要求的)和a,b,再用set去找cAC代码:#include #include #include #include #include using namespace std;int a[1005];int flag,原创 2015-03-22 20:03:58 · 537 阅读 · 0 评论 -
UVA - 729 - The Hamming Distance Problem (枚举排列)
思路:数组中有H个1, N-H个0,按照字典序全排列,注意这里数组可以开int型的也可以开char型的,char型的在这里感觉用起来更方便,至少不要for循环,用char型的数组记得要初始化(memset),或者s[N] = '\0',因为这里有多组数据。AC代码①:#include #include #include #include using namespace st原创 2015-03-20 10:11:33 · 1274 阅读 · 0 评论 -
UVA - 10098 - Generating Fast (枚举排列)
思路:生成全排列,用next_permutation,注意生成之前先对那个字符数组排序。AC代码:#include #include #include #include #include using namespace std;char str[20];int main() { int n; cin >> n; while(n--) { scanf("%原创 2015-03-19 23:49:27 · 792 阅读 · 0 评论 -
UVA - 146 - ID Codes (枚举排列)
UVA - 146ID CodesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionIt is 2084 and the year of Big Brother has原创 2015-03-19 22:51:55 · 695 阅读 · 0 评论 -
UVA - 10167 - Birthday Cake (简单枚举)
思路:简单枚举AC代码:#include #include #include #include #include using namespace std;int x[105], y[105];int main() { int A, B, N; while(scanf("%d", &N), N) { for(int i = 0; i < 2 * N; i++原创 2015-03-19 21:02:24 · 750 阅读 · 0 评论 -
hihoCoder - 1094 - Lost in the City (暴力枚举!!)
#1094 : Lost in the City时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi gets lost in the city. He does not know where he is. He does not know which direction is north.Fort原创 2015-02-03 22:20:03 · 1952 阅读 · 0 评论 -
UVA - 10344 - 23 out of 5 (暴力)
23 out of 5题目传送:23 out of 5解法:直接暴力,记得每次dfs调用都要回溯AC代码:#include <map>#include <set>#include <cmath>#include <deque>#include <queue>#include <stack>#include <cstdio>#include <cctype>#include <stri原创 2015-08-03 10:57:43 · 574 阅读 · 0 评论