![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法设计-推理
lab104_yifan
这个作者很懒,什么都没留下…
展开
-
UVA 10771 - Barbarian tribes(推理)
Barbarian tribes In a lost land two primitive tribes coexist: Gareds and Kekas. Every summer solstice they meet and compete to decide which tribe will be the favorite of the gods for the原创 2014-01-08 18:23:29 · 1182 阅读 · 0 评论 -
UVA 1526 - Edge Detection(推理+二分)
题目链接:1526 - Edge Detection题意:给定一个像素信息,每个像素变化为与周围像素的绝对值的最大值,问变化后的信息是怎样的。思路:由于像素点是非常多的,直接暴力肯定不行。题目说了只有1000条像素段,那么对于每个像素段,只要把交界地方拿出来考虑,接着把周围9个全考虑就可以了,最多考虑9000个位置。这样时间上就足够了,然后在查找像素对应位置的值可以用二分实现。原创 2014-04-04 12:28:28 · 1296 阅读 · 0 评论 -
UVA 1468 - Restaurant(推理)
题目链接:1468 - Restaurant题意:给定A,B公寓和一些餐馆坐标,要在要么比A或要么比B近的位置(曼哈顿距离)建新餐馆,问有几个位置。思路:由于A,B本身自带餐馆,所以答案肯定在A,B之间了,然后在AB之间每有一个点,就会有一些位置被限制掉,被限制掉的位置如图中红色区域。这个区域比起两边都是高度不断多1的,并且上下是对称的。所以可以先当成全在上面,for两遍,原创 2014-04-03 19:46:02 · 1477 阅读 · 3 评论 -
UVA 646 POJ 1058 The Gourmet Club(推理)
链接:646 - The Gourmet ClubUVA上未能AC,找不到BUG。POJ上过了题意:16个人,安排5天宴席,要让16个人互相都认识,现在给出前3天,要求出后两天的情况。思路:推理,每两个人间只会有一次同桌,超过则不可能了,每两个人间一定要有一次同桌,并且同桌以后,剩下的2个人必须与这两个人都可以同桌这样就能找出第4天第1桌的情况,在由这第一桌的情况可以推出第5天所有原创 2014-04-05 13:02:28 · 1680 阅读 · 0 评论 -
UVA 229 - Scanner(推理)
题目链接:229 - Scanner题意:一个扫描仪,如图摆放,现在输入每个扫描线上的个数,求能否推测出扫描物体的形状,如果可以输出,如果不能的话,就输出空白图思路:这题本来想DFS去写,后来想想一共150个点,那么就有2^150的情况,在怎么剪枝肯定都不行的。于是放弃这个想法。然后一直YY就YY了一个想法,每次从可以确定的线一条条去推,直到可以推完所有的线,如果不能推完所有线就是原创 2014-04-06 17:38:47 · 1176 阅读 · 0 评论 -
UVA 1315 - Crazy tea party(数论+推理)
题目链接:1315 - Crazy tea party原创 2014-04-13 13:05:05 · 1082 阅读 · 0 评论 -
UVA 10339 - Watching Watches(数论+推理)
题目链接:10339 - Watching Watches题意:两个时钟,一个每天慢a原创 2014-04-13 13:08:03 · 1783 阅读 · 0 评论 -
UVA 10843 - Anne's game(Cayley定理)
UVA 10843 - Anne's game题目链接题意:题意说得挺绕的,其实本质上就是求n个点,可以接连出多少种不同的生成树思路:这是Caylay定理,网上能找到证明,结果为nn−2,然后利用快速幂去求解。代码:#include #include const int long long MOD = 2000000011;int t;long long n;原创 2014-05-23 21:59:41 · 1194 阅读 · 0 评论 -
10601 - Cubes(Ploya)
UVA 10601 - Cubes题目链接题意:给定正方体12条棱的颜色,要求用这些棱能组成多少不同的正方体思路:利用ploya定理去求解,分类讨论,正方体一共24种旋转,对应的旋转方式有4种:1、不动2、沿两面中点连线旋转3、沿对顶点连线旋转4、沿两棱中点连线旋转简单推算出每种情况对应的循环组数,在加上组合数学去进行选择颜色求解,注意第4种情况中,原创 2014-07-18 22:13:44 · 1464 阅读 · 0 评论 -
HDU 4972 A simple dynamic programming problem(推理)
HDU 4972 A simple dynamic programming problem题目链接推理,会发现只有前一个和当前一个分数为(1, 2)或(2, 1)的时候,会有两种加分方法,其他情况最多就一种情况,所以只要统计(1, 2),(2, 1)的个数,最后判断分差是否为0,如果不为0,那么可能是正或负,那就是两倍代码:#include #include原创 2014-08-21 21:50:31 · 972 阅读 · 0 评论 -
UVA 10693 10693 - Traffic Volume(数论)
题目链接:10693 - Traffic Volume根据物理知识, 车经过的时间等于,距离/速度,所以可以列出公式t = (l + d)/v,v/2f + d/v,只有当v / 2f = d/v时,时间最小,v = sqrt(2df),之后时间也能算了。#include #include #include double l, f;int main() { while (~s原创 2014-04-27 11:12:45 · 1533 阅读 · 0 评论 -
HDU 4764 Stone(博弈+推理)
StoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 545 Accepted Submission(s): 405Problem DescriptionTang and Jiang are goo原创 2014-03-09 20:42:09 · 1396 阅读 · 0 评论 -
HDU 4762 Cut the Cake(概率+推理+高精度)
Cut the CakeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 721 Accepted Submission(s): 365Problem DescriptionMMM got a big b原创 2014-03-09 20:46:37 · 1552 阅读 · 0 评论 -
UVA 11714 - Blind Sorting(推理贪心)
I I U P C 2 0 0 9 Problem B: Blind Sorting I am a polar bear. But I am not just an ordinary polar bear. Yes I am extra ordinary! I love to play with numbers.原创 2014-01-12 17:20:14 · 1738 阅读 · 0 评论 -
UVA 11387 - The 3-Regular Graph(构造问题+推理证明)
I I U C O N L I N E C O N T E S T 2 0 0 8Problem C: The 3-Regular GraphInput: standard inputOutput: standard output The degree of a vertex in a graph原创 2014-01-12 17:38:07 · 1440 阅读 · 0 评论 -
UVA 11986 - Save from Radiation(推理)
Most of you are aware of Nuclear Power Plant Explosion at Fukushima after devastating earth quake and tsunami. Many people in Bangladesh were seen to be concerned with radiation. The message says:原创 2014-01-13 22:52:28 · 1410 阅读 · 0 评论 -
UVA 11549 - Calculator Conundrum(模拟+周期规律)
Problem CCALCULATOR CONUNDRUMAlice got a hold of an old calculator that can display n digits. She was bored enough to come up with the following time waster.She enters a number k then repe原创 2014-01-19 00:46:30 · 1867 阅读 · 0 评论 -
UVA 1330 - City Game(扫描方法 | 单调栈维护)
Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees, factories and buildin原创 2014-01-20 11:29:11 · 1521 阅读 · 0 评论 -
UVA 10535 - Shooter(扫描+几何+最大重叠区间)
Problem EShooterInput: Standard InputOutput: Standard OutputTime Limit: 5 Seconds The shooter is in a great problem. He is trapped in a 2D maze with a laser gun and can use it once. The gu原创 2014-01-20 17:11:28 · 1462 阅读 · 0 评论 -
1392 - DNA Regions(推理+贪心+二分)
A DNA sequence or genetic sequence is a succession of letters representing the primary structure of a real or hypothetical DNA molecule or strand, with the capacity to carry information. The possible原创 2014-02-05 22:42:09 · 1302 阅读 · 0 评论 -
1442 - Cav(扫描+推理)
As an owner of a land with a cave you were delighted when you last heard that underground fuel tanks are great business. Of course, the more volume one can store, the better. In case of your cave, the原创 2014-02-10 20:42:10 · 1964 阅读 · 0 评论 -
UVA 1474(dp + 推理)
Flatland government is building a new highway that will be used to transport weapons from its main weapon plant to the frontline in order to support the undergoing military operation against its neigh原创 2014-03-08 22:26:47 · 1293 阅读 · 0 评论 -
HDU 4944 FSF’s game(数论+递推)
#include #include typedef unsigned long long ll;const ll MOD = (1ULL<<32);const int N = 500001;int t, n;ll ans[N], frc[N];void init() { for (ll i = 1; i < N; i++) { for (ll j = i; j <原创 2014-08-12 23:52:13 · 1201 阅读 · 0 评论