标签:back 版本 about 图片 ant only was some pen
Problem Description
Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positive area) parallelogram. Points not necessary were given in the order of clockwise or counterclockwise traversal.
Alex had very nice test for this problem, but is somehow happened that the last line of the input was lost and now he has only three out of four points of the original parallelogram. He remembers that test was so good that he asks you to restore it given only these three points.
Input
The input consists of three lines, each containing a pair of integer coordinates xi and yi (?-?1000?≤?xi,?yi?≤?1000). It‘s guaranteed that these three points do not lie on the same line and no two of them coincide.
Output
First print integer k — the number of ways to add one new integer point such that the obtained set defines some parallelogram of positive area. There is no requirement for the points to be arranged in any special order (like traversal), they just define the set of vertices.
Then print k lines, each containing a pair of integer — possible coordinates of the fourth point.
Example
0 0
1 0
0 1
3
1 -1
-1 1
1 1
这题出的问题倒不是在于别的。而是由于变量名称重复一直产生的编译错误。
在Microsoft vc++2010和2017的环境中。如果包含了iostream头文件。再有x1,y1的变量名会产生冲突,出现奇怪的编译错误。(2017版本的报错行数更多)(玄学)
换成cstdio头文件则不会有这类问题。
还奇怪的是将结构体中的x,y换成x1,y1.外部的x1,y1换成x,y则不会出现这样的问题。
就很玄学。
AC代码如下
#include<cstdio> using namespace std; struct node{ int x,y; }n1[3]; int x1,y1,ans1,ans2; int main(){ scanf("%d%d%d%d%d%d",&n1[0].x,&n1[0].y,&n1[1].x,&n1[1].y,&n1[2].x,&n1[2].y); printf("3\n"); for(int i=0;i<3;i++){ ans1=(i+1)%3,ans2=(i+2)%3; x1=n1[ans1].x+n1[ans2].x-n1[i].x; y1=n1[ans1].y+n1[ans2].y-n1[i].y; printf("%d %d\n",x1,y1); } return 0; }
2020 BIT冬训-贪心 F - Parallelogram is Back CodeForces - 749B
标签:back 版本 about 图片 ant only was some pen
原文地址:https://www.cnblogs.com/mikku39/p/14393327.html