编程介的小学生 2019-08-09 23:46 采纳率: 20.5%
浏览 119

如何处理这里的序列,用的方法,C语言

Problem Description

The Dean has determined that mathies have outgrown the building that has served them so well for many years. Luckily for him, the PM has decided to stimulate the economy by funding a new math building. To maximize the stimulating effect, the construction process is outsourced to a software engineering consultant who employs agile methodologies. The building will be built first, and designed later. The Dean has some concerns about this innovative process. After all, it would be very embarrassing if the walls of the new math building failed to line up at right angles!

The Dean sneaks out one night with a tape measure to survey the last remaining grassy area on campus, where the new building will go. He drives stakes into the ground, then measures the distances between them. Afterwards, he retreats into his office to construct a map from his measurements. He notices that the first three stakes form a right-angled triangle with arms of length one metre and hypotenuse of length sqrt(2) metres. And that's not all. The Dean plots these first three stakes on a piece of graph paper at coordinates (0,0), (0,1), and (1,0). After plotting some of the other stakes, it turns out that all of the stakes happen to be precisely at lattice points (i.e. points with integer coordinates) on the graph paper. Still, plotting all of the many stakes is tedious, so he asks his co-op student (i.e. you) to help out.

Input
Input consists of a number of test cases. The first line of each test case contains two integers n and m, each at least 1 and no larger than 1000. The integer n is the number of lines that follow, and m is the number of stakes. The stakes are numbered from 1 to m. All of the stakes are at distinct locations. The x and y coordinates of each stake are no less than -1000000 and no greater than 1000000. Each of the following lines contains exactly six integers a, b, c, x, y, z. The integers a, b, and c are the numbers of three stakes. The three stakes are always listed in counter-clockwise order. That is, to move from stake a to stake b and then to stake c, one must turn left at stake b. The number x is the square of the distance from stake a to stake b. The number y is the square of the distance from stake b to stake c. The number z is the square of the distance from stake c to stake a. Every stake will appear in at least one line of the input. For every pair of stakes a, b, there is a subset of the triangles in the input that forms a sequence T1, T2, ..., Tn such that two of the vertices of Ti are also vertices of Ti+1 for all 0 < i < n, a is a vertex of T1, and b is a vertex of Tn. The last line of input is 0 0. These zeros are not values of n and m, and should not be processed as such.

Output
Output consists of exactly m lines for each test case. The m lines describe the stakes 1 to m in sequence. Each line contains two integers, giving the x and y coordinates of the stake. The first three lines of output for each test case are always:

0 0
0 1
1 0

Sample Input
1 3
1 3 2 1 2 1
0 0

Sample Output
0 0
0 1
1 0

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多