CodeForces - 18A Triangle(数学?)】的更多相关文章

传送门 题意: 给出三个点的坐标,初始,这三个点可以构成一个三角形. 如果初始坐标可以构成直角三角形,输出"RIGNT". 如果某个点的 x或y 坐标移动一个单位后可以组成直角三角形,输出"ALMOST". 如果不能构成直角三角形,输出"NEITHER". 题解: 我的思路: 如何判断是否含有直角呢--向量. a,b,c 三点可以构成三条向量 ab,ab,bc(不考虑方向),如果存在某两条向量的点乘积为0,那么这两个向量垂直. AC代码: #in…
题面 题意:给你n,m,k,在你在(0,0)到(n,m)的矩形内,选3个格点(x,y都是整数),使得三角形面积为n*m/k,不能找到则输出-1 题解:由毕克定理知道,格点多边形的面积必为1/2的整数倍,所以首先n*m/k必须是1/2的整数倍,也就是2*n*m%k要等于0,不等于就输出-1 然后对于面积,我们知道底✖高*1/2=面积,a*b*1/2=n*m/k,我们很显然想到一种构造方法,(0,0),(0,a),(b,0); 有人就要问,会不会有一种,使得无法找到整数a,b,满足这种直角三角形点,…
Link:  http://codeforces.com/contest/407/problem/A 给定直角三角形的2个直角边a,b.求在直角坐标系中,是否存在对应的直角三角形,使得三个定点都在整点上,并且三边都不和坐标轴平行. 如果存在,输出YES,和三个点的坐标.否则输出NO 很显然,为了方便,可以把原点作为 一个顶点. 这道题目做的时候少考虑了很多情况. 比如: 如何使得边不和坐标轴平行?  要保证要求的另外两个点的横坐标或者纵坐标不能相等. 如何保证三角形是直角三角形? 只需要保证,另…
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, whose lengths are 1,2, 3⋯n respectively. Wallice is a bad man, so he does not want Mr. Frog to form a triangle with three of the sticks here. He decides…
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…
KIDx's Triangle Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description One day, KIDx solved a math problem for middle students in seconds! And than he created this problem. N…
Triangle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description This is a simple question, give you a triangle, please divide the triangle into two p…
Rock-Paper-Scissors 题目连接: http://codeforces.com/problemset/problem/173/A Description Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is play…
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…
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y. Your favorite ratio…