![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
暴力-直接枚举
lab104_yifan
这个作者很懒,什么都没留下…
展开
-
UVA 10167 Birthday Cake
UVA 10167 Birthday Cake切蛋糕,保证一刀切后,两边樱桃数相同, 切过去的方程Ax+By = 0 可能有很多条, 输出一条即可很水啊。。直接暴力水过#include #include int n;int x[105], y[105];int a, b;int shang , xia;int judge;int main(){原创 2013-07-18 01:52:47 · 1295 阅读 · 0 评论 -
UVA 608 - Counterfeit Dollar(直接枚举)
Counterfeit Dollar Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make原创 2014-01-27 21:27:37 · 1460 阅读 · 0 评论 -
11776 - Oh Your Royal Greediness!(最大重叠区间)
Problem FOh Your Royal Greediness!Input: Standard InputOutput: Standard Output Once upon a time there lived a greedy landlord in a not far far away country. The landlord used to employ armed原创 2014-01-12 19:14:36 · 1165 阅读 · 0 评论 -
UVA 221 - Urban Elevations(枚举+区间覆盖)
Urban Elevations An elevation of a collection of buildings is an orthogonal projection of the buildings onto a vertical plane. An external elevation of a city would show the skyline and原创 2014-02-10 08:18:22 · 3484 阅读 · 0 评论 -
UVA 1354 - Mobile Computing(暴力枚举)
There is a mysterious planet called Yaen, whose space is 2-dimensional. There are many beautiful stones on the planet, and the Yaen people love to collect them. They bring the stones back home and mak原创 2014-02-26 11:27:30 · 2131 阅读 · 0 评论 -
10609 - Fractal (模拟,dfs)
Problem AFractalInput: Standard InputOutput: Standard OutputTime Limit: 3 Seconds A fractal is a rough or fragmented geometric shape that can be subdivided in parts, each of which is (at l原创 2014-02-27 12:35:30 · 1263 阅读 · 0 评论 -
1554 - Binary Search(暴力枚举)
The program fragment below performs binary search of an integer number in an array that is sorted in a nondescending order:Pascal (file "sproc.pas")C (file "sproc.c")const MAXN =原创 2014-02-28 23:44:59 · 1405 阅读 · 0 评论 -
UVA 10729 - Treequivalence(暴力枚举)
Problem C: TreequivalenceThe following grammar describes a textual notation for a tree with (not necessarily unique) vertex labels: tree ::= label tree ::= label ( subtrees ) subtrees ::=原创 2014-03-01 13:19:52 · 1387 阅读 · 0 评论 -
UVA 102 - Ecological Bin Packing(暴力)
Ecological Bin Packing BackgroundBin packing, or the placement of objects of certain weights into different bins subject to certain constraints, is an historically interesting proble原创 2014-03-03 15:23:51 · 1188 阅读 · 0 评论 -
UVA 105 - The Skyline Problem(暴力枚举)
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=41&mosmsg=Submission+received+with+ID+13257619题意:给定一些房子的左高右,求出各个房子高度变化的转折点思路:直接暴力,记录下每原创 2014-03-04 11:42:07 · 1708 阅读 · 0 评论 -
609 - Metal Cutting(几何+暴力)
Metal Cutting In order to build a ship to travel to Eindhoven, The Netherlands, various sheet metal parts have to be cut from rectangular pieces of sheet metal. Each part is a convex pol原创 2014-03-13 01:15:10 · 1453 阅读 · 0 评论 -
UVA 617 - Nonstop Travel(数论+暴力枚举)
题目链接:617 - Nonstop Travel题意:给定一些红绿灯,现在速度能在30-60km/h之内,求多少个速度满足一路不遇到红灯。思路:暴力每一个速度,去判断可不可以,最后注意下输出格式即可代码:#include #include #include const double esp = 1e-6;int n, vis[105];struct D { do原创 2014-04-28 12:48:20 · 1161 阅读 · 0 评论 -
Codeforces 425A Sereja and Swaps(暴力枚举)
题目链接:A. Sereja and Swaps题意:给定一个序列,可以交换k次,问交换完后的子序列最大值的最大值是多少思路:暴力枚举每一个区间,然后每个区间[l,r]之内的值先存在优先队列内,然后找区间外如果有更大的值就替换掉。求出每个区间的最大值,最后记录下所有区间的最大值代码:By lab104_yifan, contest: Codeforces Round #243 (D原创 2014-04-28 13:21:31 · 2026 阅读 · 1 评论 -
UVA 618 - Doing Windows(数论)
题目链接:618 - Doing Windows题意:给定一个大小不能变的屏幕,和四个大小可以变的窗口,变化要保持长宽比,问这四个窗口能不能调整后全部放下正好填满屏幕,不能重叠思路:情况一共就几种:4个叠一起,3个叠一起+一个,2个和2个,一个和两个叠一起在一个,把这几种情况全判断了就可以了,判断过程利用gcd,lcm可以求边长。代码:#include #include lo原创 2014-04-28 12:51:31 · 1541 阅读 · 0 评论 -
HDU 4584(2013杭州邀请赛I题-水)
http://acm.hdu.edu.cn/showproblem.php?pid=4584题意:找出一条HC路线,要求HC的曼哈顿距离尽量小,H的x坐标尽量小,y坐标尽量小,C的x坐标尽量小,y坐标尽量小。思路:直接在每条边去找出答案即可,我是直接排个序就找出答案。代码:#include #include #include #include using namespace原创 2014-03-23 21:40:47 · 1284 阅读 · 0 评论 -
HDU 4770 Lights Against Dudely(暴力)
HDU 4770 Lights Against Dudely题目链接题意:给定灯,有一盏灯可以旋转,问最少几个灯可以照亮.的位置,并且不能照到#思路:暴力求解,先枚举特殊的灯,再枚举正常的灯,要加剪枝,不然会TLE代码:#include #include #include using namespace std;const int INF = 0x原创 2014-07-06 21:04:45 · 1151 阅读 · 0 评论 -
HDU 4886 TIANKENG’s restaurant(Ⅱ) (暴力+Hash)
HDU TIANKENG’s restaurant(Ⅱ)题目链接题意:给定一字符串,要求找出字典序最小,并且不在该字符串连续字串中出现的字符串思路:暴力hash所有字串,然后暴力枚举即可代码:原创 2014-07-28 00:34:22 · 845 阅读 · 0 评论 -
UVA 517 - Word (周期规律+位运算)
Word Dr. R. E. Wright's class was studying modified L-Systems. Let us explain necessary details. As a model let us have words of length n over a two letter alphabet . The words are cyc原创 2014-01-27 03:11:49 · 1609 阅读 · 0 评论 -
UVA 654 - Ratio(枚举)
Ratio If you ever see a televised report on stock market activity, you'll hear the anchorperson say something like ``Gainers outnumbered losers 14 to 9,'' which means that for every 14 s原创 2013-12-25 20:54:17 · 2457 阅读 · 3 评论 -
UVA 11205 The broken pedometer 果断还是暴力吧。。。
UVA 11205 The broken pedometer这题题意一开始还理解错了。后来才知道是输出最少开几个灯,能表示所有数字。。一开始的想法是深搜。。把每一种情况找出来求出最少的。。结果很悲剧啊 超时了无数次。。。后来换思路。。用暴力。。大概思路 灯可能是开着或者关着的, 题目中灯为P盏,一盏灯有2种状态,按这样来考虑的话 一共只要枚举 2^p次 而p最多为15,原创 2013-07-18 01:56:30 · 2299 阅读 · 1 评论 -
uva146 ID Codes
uva146 ID Codes全排列的水题。 next_permutation 水过。。。#include using namespace std;#include #include char sb[25];int main(){ while(gets(sb) != NULL && sb[0] != '#') { if(next_permutation(原创 2013-07-20 20:16:59 · 1180 阅读 · 0 评论 -
uva10098 Generating Fast, Sorted Permutation
uva10098 Generating Fast, Sorted Permutation全排列水题#include using namespace std;#include #include int t;int i;char sb[25];int main(){ scanf("%d", &t); getchar(); while (t --) {原创 2013-07-20 20:19:31 · 1208 阅读 · 0 评论 -
uva729 The Hamming Distance Problem
uva729 The Hamming Distance Problem 全排列水题存1的时候要注意位置。。。 刚开始因为这个不小心wa了#include using namespace std;#include #include int t;int n, h;int i;char sb[25];int main(){ scanf("%d", &原创 2013-07-20 20:21:23 · 1141 阅读 · 0 评论 -
1352 - Colored Cubes (枚举方法)
There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be原创 2013-12-12 12:40:09 · 1445 阅读 · 0 评论 -
UVA 1523 - Helicopter(暴力枚举)
Since ancient time, people have been dreaming of flying in the sky. Eventually, the dream was realized in the 20th century. Nowadays, the airplane becomes a useful vehicle that is used frequently in o原创 2013-12-28 11:23:38 · 1986 阅读 · 0 评论 -
UVA 11210 - Chinese Mahjong(暴力枚举)
Problem CChinese MahjongMahjong () is a game of Chinese origin usually played by four persons with tiles resembling dominoes and bearing various designs, which are drawn and discarded until原创 2013-12-16 16:15:21 · 1695 阅读 · 0 评论 -
UVA 798 - Tile Puzzle(暴力枚举)
Tile Puzzle In a puzzle a rectangular surface of width w and height h is split into a collection of rectangular tiles. The tiles with the same dimensions form a similarity group. Solving原创 2014-01-01 12:11:55 · 1874 阅读 · 0 评论 -
codeforces GOOD BYE 2013
A. New Year Candlestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasily the Programmer loves romance, so原创 2013-12-31 13:41:46 · 2375 阅读 · 2 评论 -
UVA 818 - Cutting Chains(暴力+dfs判环+位运算)
Cutting Chains What a find! Anna Locke has just bought several links of chain some of which may be connected. They are made from zorkium, a material that was frequently used to manufactu原创 2014-01-04 11:23:34 · 5516 阅读 · 2 评论 -
UVA 687 - Lattice Practices(暴力枚举+位运算)
Lattice Practices Once upon a time, there was a king who loved beautiful costumes very much. The king had a special cocoon bed to make excellent cloth of silk. The cocoon bed had 16 smal原创 2013-12-30 23:08:55 · 1444 阅读 · 1 评论 -
uva 471 - Magic Numbers(枚举技巧)
Magic Numbers Write a program that finds and displays all pairs of integers and such that:neither nor have any digits repeated; and , where N is a given integer;Input and Outpu原创 2013-12-21 20:12:47 · 1882 阅读 · 0 评论 -
UVA 585 - Triangles(枚举)
Triangles It is always very nice to have little brothers or sisters. You can tease them, lock them in the bathroom or put red hot chili in their sandwiches. But there is also a time when原创 2013-12-24 00:17:36 · 1680 阅读 · 0 评论 -
UVA 10396 - Vampire Numbers(暴力打表)
Problem DVampire NumbersInput: standard inputOutput: standard outputTime Limit: 5 seconds A number v = xy with an even number (n) of digits formed by multiplying a pair of n/2-digit number原创 2014-01-07 19:21:47 · 1427 阅读 · 0 评论 -
812 - Trade on Verweggistan (暴力枚举)
Trade on Verweggistan Since the days of Peter Stuyvesant and Abel Tasman, Dutch merchants have been traveling all over the world to buy and sell goods. Once there was some trade on Verwe原创 2013-12-25 13:13:33 · 1667 阅读 · 0 评论 -
UVA 817 - According to Bartjens(暴力搜索)
According to Bartjens The wide dissemination of calculators and computers has its disadvantages. Even students in technical disciplines tend to exhibit a surprising lack of calculating a原创 2013-12-27 13:44:20 · 2816 阅读 · 0 评论 -
UVA 1509 Leet(暴力)
UVA 1509 Leet题目链接题意:给定一个字符串和一个字符串,第一个字符串字母可以映射1-k个字母,问第一个字符串能否表示成第二个字符串思路:dfs暴力枚举即可代码:#include #include const int N = 305;int t, k, n, m, v[N], len[N];char a[60], b[60];char原创 2014-07-27 18:42:30 · 888 阅读 · 0 评论