[Codeforces 15E] Triangle】的更多相关文章

Brief Introduction: 求从N出发,回到N且不包含任何黑色三角的路径数 Algorithm:假设从N点到第二层中间的节点M的路径数为k,易知总路径数为(k*k+1)*2 而从第第四层开始,每两行之间的形状是具有规律的,我们称之为一个“凹槽”. 每个“凹槽”的方案数是具有规律的:2n-2到2n间的方案数F(n)=2^n-3(不考虑从最外层跳到次外层) 所以到恰好到第2n层的总方案数S(n)=4*F(3)*F(4)......*F(n),res=6+S(3)+S(4)....+S(n…
Codeforces 15E Triangles Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by t…
Link:  http://codeforces.com/contest/407/problem/A 给定直角三角形的2个直角边a,b.求在直角坐标系中,是否存在对应的直角三角形,使得三个定点都在整点上,并且三边都不和坐标轴平行. 如果存在,输出YES,和三个点的坐标.否则输出NO 很显然,为了方便,可以把原点作为 一个顶点. 这道题目做的时候少考虑了很多情况. 比如: 如何使得边不和坐标轴平行?  要保证要求的另外两个点的横坐标或者纵坐标不能相等. 如何保证三角形是直角三角形? 只需要保证,另…
Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but…
C. Triangle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on…
A. Triangle time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother abou…
传送门 题意: 给出三个点的坐标,初始,这三个点可以构成一个三角形. 如果初始坐标可以构成直角三角形,输出"RIGNT". 如果某个点的 x或y 坐标移动一个单位后可以组成直角三角形,输出"ALMOST". 如果不能构成直角三角形,输出"NEITHER". 题解: 我的思路: 如何判断是否含有直角呢--向量. a,b,c 三点可以构成三条向量 ab,ab,bc(不考虑方向),如果存在某两条向量的点乘积为0,那么这两个向量垂直. AC代码: #in…
B. Mahmoud and a Triangle 题目连接: http://codeforces.com/contest/766/problem/B Description Mahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't…
A. Triangle 题目连接: http://codeforces.com/contest/6/problem/A Description Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to s…
地址:http://codeforces.com/contest/766/problem/A A题: A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Mahmoud and Ehab were practicing for IO…