HDU 4998 Rotate】的更多相关文章

HDU 4998 Rotate (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4998 Description Noting is more interesting than rotation! Your little sister likes to rotate things. To put it easier to analyze, your sister makes n rotations. In the i-th time, s…
题意:给n个点(x,y,p),从1~n,一次每次所有点绕着第 i 个点(原来的)逆时针转pi个弧度,问最后所有点的位置相当于绕哪个点旋转多少弧度,求出那点X和弧度P 解法:直接模拟旋转,每次计算新的坐标,最后选两个新的点分别和他们原来的点连一条线,两条线的中垂线的交点即为圆心,求出了圆心就可以求出转了多少弧度了. 注意判中垂线垂直x轴的情况以及n==1的情况. 最后角度要根据位置关系判下正负. 代码: #include <iostream> #include <cstdio> #i…
Rotate Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1232    Accepted Submission(s): 545Special Judge Problem Description Noting is more interesting than rotation! Your little sister likes to…
题意: n次旋转  每次平面绕ai点旋转pi弧度  问  最后状态相当于初始状态绕A点旋转P弧度  A和P是多少 思路: 如果初始X点的最后状态为X'点  则圆心一定在X和X'连线的垂直平分线上  那么仅仅要用在取一个点Y和Y'  相同做它的垂直平分线  两线交点即是圆心  然后用简单几何方法算出角度  最后注意要求最后状态由最初状态逆时针旋转得到  适当调整角度就可以 PS: kuangbin巨巨的几何代码还是非常easy理解的  非常好用~  谢谢~ 代码: #include<cstdio>…
为了寻找等效旋转操作,我们任选两个点P0和Q0,分别绕这n个点旋转一定的角度后最终得到Pn和Qn 然后已知:P0和Pn共圆,Q0和Qn共圆.所以要找的等效旋转点就是这两个线段的垂直平分线交点O. 等效的角度的计算,可以利用已知的等腰三角形(这里有两个)△P0PnR,做一条垂线(三线合一的性质),再利用反三角函数计算半角,再乘二 还有一种特殊情况就是,如果答案比平角要大,我们计算的角度就不对了. 此时可以让P0逆时针旋转90°得到一个P1,然后将P1和Pn的坐标分别代入直线P0R的方程,如果异号,…
http://acm.hdu.edu.cn/showproblem.php?pid=4998 这道题,在比赛的时候看了很久,才明白题目的大意.都怪自己不好好学习英语.后来经过队友翻译才懂是什么意思. 题目大意:二维平面内的物品,把它们绕给定的n个点,逆时针旋转. 现在求通过一个A点,逆时针旋转角度P就能完成这个操作. 问:这个点A的坐标,P的角度. 解题思路:随意找个点t1,绕着n个点旋转得到t2.点A一定在线段t1t2的垂直平分线上.再找一点t3,绕n个点旋转得到t4. 线段t1t2的垂直平分…
http://acm.hdu.edu.cn/showproblem.php?pid=4998 http://blog.csdn.net/wcyoot/article/details/33310329 一个旋转变换可以转化为一个三维矩阵的变化 绕(x,y)旋转角度r,执行十次,求等价旋转点和角度 绕原点矩阵如下 由于是绕(x,y),x1 = (x-x0)*cos0 - (y-y0)*sin0 + x0;y1同理,那么第三行前两列即为x0*(1-cos(r)) + y0*sin(r)和y0*(1-c…
Problem J. Let Sudoku Rotate Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Submission(s): Problem Description Sudoku is a logic-based, combinatorial number-placement puzzle, which is popular around the w…
Problem Description Noting is more interesting than rotation! Your little sister likes to rotate things. To put it easier to analyze, your sister makes n rotations. In the i-th time, she makes everything in the plane rotate counter-clockwisely around…
Problem J. Let Sudoku Rotate Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Sudoku is a logic-based, combinatorial number-placement puzzle,…
一.题意 Sudoku is a logic-based, combinatorial number-placement puzzle, which is popular around the world.In this problem, let us focus on puzzles with 16×16 grids, which consist of 4×4 regions. The objective is to fill the whole grid with hexadecimal d…
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<=b;++i) #define ms(arr,a) memset(arr,a,sizeof arr) #define debug(x) cout<<"< "#x" = "<<x<<" >"<<endl char s[…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 思路:模拟题,没啥可说的,移动的时候需要注意top的变化. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAX_N = (5000 + 500); struct Girl { int…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5091 Problem Description Recently, the γ galaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by other planets. Now, a large wave of enemy spaces…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 解题报告:一个管理聊天窗口的程序,一共有八种操作,然后要注意的就是Top操作只是把编号为u的窗口标记为一种特殊的状态,在这种特殊的状态下优先级是最高的,聊天都是跟这个聊,而这个窗口并没有在实际上被提到最前面.还有就是每句后面都有句号.我本来可以1A的,但就是因为没看这个,所以一直WA也找不到原因. 暴力模拟就可以了,因为点最多只有5000个,不会超时,维护一个队列就可以了,但我为了方便判断是不…
题意:考虑由$n$个结点构成的无向图,每条边的长度均为$1$,问有多少种构图方法使得结点$1$与任意其它节点之间的最短距离均不等于$k$(无法到达时距离等于无穷大),输出答案对$1e9+7$取模.$1 \leq n, k \leq 60$. 分析:只需要考虑那些和结点$1$在同一个连通块的结点,考虑对包含结点$1$的连通图的等价类划分:首先是结点数目,其次是所有结点到达结点$1$的最短距离的最大值,再次是最短距离等于该最大值的结点数目,因此用$dp(i, j, k)$表示与$1$在同一个连通分量…
题目大意 给一个数列,初始时为 1, 2, 3, ..., n,现在有两种共 m 个操作 操作1. CUT a b c 表示把数列中第 a 个到第 b 个从原数列中删除得到一个新数列,并将它添加到新数列中第 c 个数的后面 操作2. FLIP a b 表示把数列中第 a 个数到第 b 个数翻转 经过 m 个操作之后,输出这个数列 1≤n, m≤3*100000 做法分析 这题也不好用线段树做,用 Splay 很快就搞出来了 对于"操作1. CUT a b c" ,只需要将 a-1 旋转…
http://acm.hdu.edu.cn/showproblem.php?pid=1890 Robotic Sort Problem Description Somewhere deep in the Czech Technical University buildings, there are laboratories for examining mechanical and electrical properties of various materials. In one of yest…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4064 Problem Description Carcassonne is a tile-based board game for two to five players.Square tiles are printed by city segments,road segments and field segments. The rule of the game is to put the tile…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4063 Description You are playing a flying game. In the game, player controls an aircraft in a 2D-space. The mission is to drive the craft from starting point to terminal point. The craft needs wireless s…
http://acm.hdu.edu.cn/showproblem.php?pid=1890 题意:有一个无序序列,经过不断地翻转,使得最后的序列是一个升序的序列,而且如果相同数字要使在原本序列靠前的在前面.对于每一个位置,输出于哪个位置翻转. 思路:想通了之后其实挺简单的,不过挺巧妙.一开始先记录每一个位的pos,并对数组升序排序,然后我们从小到大枚举数组里的元素,对于每个元素,我们可以知道:i 就是翻转后应当在序列中的位置,a[i].pos就是它在原序列的位置.这个时候,我们只要在建树的时候…
http://acm.hdu.edu.cn/showproblem.php?pid=3487 题意:有两种操作:1.Flip l r ,把 l 到 r 这段区间 reverse.2.Cut a b c ,把 a 到 b 这段区间切掉,再把这段区间接到切掉后的第 c 个数的后面. 思路:做完了上一道变态题目,做这道题目如鱼得水.Cut的时候就是把a 到 b 放到keytree的位置,记录一下当前keytree的值,然后切掉,再把切掉后的第 c 个数转到 root 的位置,再把这个记录的值重新连接回…
http://acm.hdu.edu.cn/showproblem.php?pid=4453 题意:很多种操作:1.add x,将从光标起的 k2 个数全部加上 x:2.reverse,将从光标起的 k1 个数全部反转:3.insert x,在光标处的后一位插入值为 x 的数:4.delete,删除光标所在位置的数:5.move x,如果x是2,将光标右移,否则将光标左移.6.查询光标所在位置的值. 思路:在ACM中第一次写了6000+bytes的代码,把Splay几乎所有操作都汇集了,是一个很…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5412 CRB and Queries Description There are $N$ boys in CodeLand. Boy i has his coding skill $A_{i}$. CRB wants to know who has the suitable coding skill. So you should treat the following two types of qu…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5349 MZL's simple problem Description A simple problemProblem DescriptionYou have a multiple set,and now there are three kinds of operations:1 x : add number x to set2 : delete the minimum number (if the…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=3282 Running Median Description For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After each odd-indexed value is read, output the median (middle value) of th…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1908 Double Queue Description The new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using mod…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5249 KPI Description 你工作以后, KPI 就是你的全部了. 我开发了一个服务,取得了很大的知名度.数十亿的请求被推到一个大管道后同时服务从管头拉取请求.让我们来定义每个请求都有一个重要值.我的KPI是由当前管道内请求的重要值的中间值来计算.现在给你服务记录,有时我想知道当前管道内请求的重要值得中间值. Input 有大约100组数据. 每组数据第一行有一个$n(1 \leq n \…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1890 如下: #include<cstdio> #include<cstdlib> #include<iostream> #include<algorithm> using std::sort; using std::swap; ; struct node{ int val, pos; }rec[]; inline bool cmp(const node &am…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2648 纯暴力的方法T_T... 如下: #include<cstdio> #include<cstdlib> #include<string> #include<iostream> #include<algorithm> typedef ]; char *target = "memory"; ; struct Node{ Stat…