CodeForces 239A. Triangle】的更多相关文章

Link:  http://codeforces.com/contest/407/problem/A 给定直角三角形的2个直角边a,b.求在直角坐标系中,是否存在对应的直角三角形,使得三个定点都在整点上,并且三边都不和坐标轴平行. 如果存在,输出YES,和三个点的坐标.否则输出NO 很显然,为了方便,可以把原点作为 一个顶点. 这道题目做的时候少考虑了很多情况. 比如: 如何使得边不和坐标轴平行?  要保证要求的另外两个点的横坐标或者纵坐标不能相等. 如何保证三角形是直角三角形? 只需要保证,另…
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…
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…
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…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output 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 triangl…
题目链接:http://codeforces.com/problemset/problem/336/A 好简单的一条数学题,是8月9日的.比赛中没有做出来,今天看,从pupil变成Newbie了,那个伤心啊----不是分数的缘故,而是心态!!!昨晚一直卡机,网页很久才打得开,35min才进入比赛页面,接着做的时候又非常浮躁,静不下心来,提交时再次卡机,临20多min才提交成功,于是罢想!!心态真不好!!!这是第一次做题做得那么糟糕,要端正心态才行,遇到什么紧急情况都要冷静,保持清醒的头脑. 题意…