POJ 3889 Fractal Streets(逼近模拟)】的更多相关文章

$ POJ~3889~Fractal~Streets $(模拟) $ solution: $ 这是一道淳朴的模拟题,最近发现这种题目总是可以用逼近法,就再来练练手吧. 首先对于每个编号我们可以用逼近法求出它在各个图上是处于左上,右上,左下,右下中的哪一个. inline void bijin(int i,int v){ if(i==0)return ; rg x=1<<(i*2-2),y=1; while(v>x)v-=x,++y; t[i]=y; bijin(i-1,v); } 然后我…
分形街道 我干,这个毒瘤. 想起来就头痛. 首先看题就是一大难题...... 说一下题目大意吧. 每当n+1时,把n阶图复制为4份.2*2排好. 右边两个不动.左上顺时针旋转90°,左下逆时针旋转90° 求n阶图中a和b的直线距离. 考虑递归解决:这TM怎么递归啊!!! 仿佛可以......我一开始带了十多个变量,后来缩减到了8个,自觉很ok了 标答带了两个变量.我:................ 我们不管标答,继续钻研中国特色射惠主义. 然后我以为每次旋转完之后内部遍历顺序不会变,于是自信W…
Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, profes…
题目链接 题意 : 一个10×15的格子,有三种颜色的球,颜色相同且在同一片内的球叫做cluster(具体解释就是,两个球颜色相同且一个球可以通过上下左右到达另一个球,则这两个球属于同一个cluster,同时cluster含有至少两个球),每次选择cluster中包含同色球最多的进行消除,每次消除完之后,上边的要往下移填满空的地方,一列上的球移动之前与之后相对位置不变,如果有空列,右边的列往左移动,每一列相对位置不变 . 思路 : 模拟......不停的递归..... ////POJ 1027…
链接: http://poj.org/problem?id=3414 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22009#problem/J Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8253   Accepted: 3499   Special Judge Description You are given two pots, havin…
这两天自学了一线算法导论里分治策略的内容,秉着只有真正投入投入编程,才能更好的理解一种算法的思想的想法,兴致勃勃地找一些入门的题来学习. 搜了一下最后把目光锁定在了Poj fractal这一个题上.以前一直对这种题无从下手,通过对这一条题的分析与理解,算是第一次对分治思想有一个较为具象的了解. 分治思想的依托为递归. 下面我尝试用分支策略的思想描述这一题. 分解: 在这条题里,通过分析题目可以知道:每一个更大一点的图形都是由前一个状态的小图形放置在对应位置组成的:而每一个小图形的又由更前一个状态…
链接:poj 2632 题意:在n*m的房间有num个机器,它们的坐标和方向已知,现给定一些指令及机器k运行的次数, L代表机器方向向左旋转90°,R代表机器方向向右旋转90°,F表示前进,每次前进一米 若前进时机器i撞到机器j,输出"Robot i crashes into robot j " 若机器走出了n*m的房间,输出"Robot i crashes into the wall " 当出现上述情况.仅仅需输出第一次出现上述的情况 若全部指令运行完,全部机器都…
题目链接:http://poj.org/problem? id=1028 Description Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be rea…
题目链接:http://poj.org/problem?id=3087 题目大意:已知两堆牌s1和s2的初始状态, 其牌数均为c,按给定规则能将他们相互交叉组合成一堆牌s12,再将s12的最底下的c块牌归为s1,最顶的c块牌归为s2,依此循环下去. 现在输入s1和s2的初始状态 以及 预想的最终状态s12.问s1 s2经过多少次洗牌之后,最终能达到状态s12,若永远不可能相同,则输出"-1". 解题思路:照着模拟就好了,只是判断是否永远不能达到状态s12需要用map,定义map<…
链接: http://poj.org/problem?id=1068 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#problem/B Parencodings Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17044   Accepted: 10199 Description Let S = s1 s2...s2n be a well-forme…
Fractal Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6646   Accepted: 3297 Description A fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit exactly…
题意:给定一串字符,u表示是上坡,d表示下坡,f表示平坦的,每个有不同的花费时间,问你从开始走,最远能走到. 析:直接模拟就好了,没什么可说的,就是记下时间时要记双倍的,因为要返回来的. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3840   Accepted: 2397 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
题目链接:http://poj.org/problem?id=3087 Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Each…
Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Each stack may contain chips of several…
题目链接 Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms. If the word is absent in…
Description Fractals are really cool mathematical objects. They have a lot of interesting properties, often including: 1. fine structure at arbitrarily small scales; 2. self-similarity, i.e., magnified it looks like a copy of itself; 3. a simple, rec…
Description Andy is fond of old computers. He loves everything about them and he uses emulators of old operating systems on his modern computer. Andy also likes writing programs for them. Recently he has decided to write a text editor for his favorit…
Death to Binary? Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1707   Accepted: 529 Description The group of Absurd Calculation Maniacs has discovered a great new way how to count. Instead of using the ordinary decadic numbers, they us…
传送门:http://poj.org/problem?id=1017 Packets Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 59106 Accepted: 20072 Description A factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5…
题目地址:http://poj.org/problem?id=1028 测试样例: Sample Input VISIT http://acm.ashland.edu/ VISIT http://acm.baylor.edu/acmicpc/ BACK BACK BACK FORWARD VISIT http://www.ibm.com/ BACK BACK FORWARD FORWARD FORWARD QUIT Sample Output http://acm.ashland.edu/ ht…
题目链接: http://poj.org/problem?id=2083 题目描述: n = 1时,图形b[1]是X n = 2时,图形b[2]是X  X        X                                  X  X 所以n时,图形b[n]是b[n-1]         b[n-1]   b[n-1] b[n-1]        b[n-1] 解题思路: 用递归打印图形,存到二维数组里面,输出是一个矩形,竟然是一个矩形!!!!!! 代码: #include <cm…
题目代号:POJ 1573 题目链接:http://poj.org/problem?id=1573 Language: Default Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14195   Accepted: 6827 Description A robot has been programmed to follow the instructions in its path. Instr…
Instant Complexity Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 1908   Accepted: 658 Description Analyzing the run-time complexity of algorithms is an important tool for designing efficient programs that solve a problem. An algorithm…
Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Description A flow layout manager takes rectangular objects and places them in a rectangular window from left to right. If there isn't enough room in one r…
Description Willy the spider used to live in the chemistry laboratory of Dr. Petro. He used to wander about the lab pipes and sometimes inside empty ones. One night while he was in a pipe, he fell asleep. The next morning, Dr. Petro came to the lab.…
去年校赛团队赛就有一道分形让所有大一新生欲生欲死…… 当时就想学了 结果一直拖到…… 今天上午…… 马上要省选了 才会一点基础分形…… 还是自己不够努力啊…… 分形主要是要找到递归点…… 还有深度…… 还有深度对应的长度 宽度…… 看了好久才看懂…… 最后要'\0'…… 还要清空格…… 打出来觉得不是很难…… 但就是怕像高中班任说的那样 换个数就不会了…… 希望能学以致用…… 还有两个小时省选…… 总感觉这次省选凶多吉少…… 不管怎么样 正常发挥就好…… 希望可以去商大打省赛…… #includ…
题意:有个R*C的格网.上面有若干个点,这些点可以连成一些直线,满足:这些点在直线上均匀排布(也就是间隔相等),直线的两段穿过网格(也就是第一个,最后一个在网格的边界附近) 求某条直线上最多的点数 题解:先排序,再任取两个水稻,算出之间的dx,dy,然后就能推出前后的水稻坐标,用如果满足路径上一直有水稻(用binarysearch),且第一个点与最后一个点在水稻外面,就是一个可行的解,维护其最大值. 注意一些判断. ac代码: #include<iostream> #include<al…
给出两点编号,求如图所示的图中两点间欧氏距离*10取整 递归处理由编号求出坐标 #include<cstdio> #include<cmath> int T,n,s,t; void get(int n,int p,int&x,int&y){ if(!n){ x=y=; return; } <<n*-,L=<<n-; int w=p/D; ,p&(D-),x,y); ){ int x0=x,y0=y; x=y0,y=x0; }){ x+…
                                                                                                               Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11462   Accepted: 5558 Description A robot has been programmed to…