F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

New Ground

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 861    Accepted Submission(s): 357


Problem Description
Your school has a large ground. Recently the school wants a new ground similar to the former one.
The ground is a simple polygon. Suppose it has n edges and the old one is A0,A1,…,An-1, the new one is B0,B1,…,Bn-1.
They must be one-to-one mapping.
The new ground can be only worked out by rotating, expanding, contracting and shifting, but not flipping.
Now you know all the points of the old ground, B0, and B1. Can you calculate the other points of the new ground?
 

Input
The first line contains one integer T representing the number of test cases.
For each case, first line contains one integer n (3<=n<=10000).
Then n lines follow. The i-th line has two integers representing the coordinate of the point Ai. (For each 0<=i<j<n, Ai doesn't equals Aj)
Following one line contains four integers. The first two integers represent the coordinate of the point B0, and the second two integers represent the coordinate of the point B1. B0 never equals B1.
All coordinates are within [-10000, 10000].
The old ground always has a positive area.
 

Output
For each test case, in the first line print the case number.
Then print n lines followed. The i-th line contains two numbers separated by one space representing the coordinate of the point Bi, rounded to 2 digits after the decimal point.

Please follow the format of the sample output.
 

Sample Input
2 3 0 0 1 0 0 1 2 0 2 2 4 0 0 2 0 2 1 0 1 5 0 5 1
 

Sample Output
Case 1: 2.00 0.00 2.00 2.00 0.00 0.00 Case 2: 5.00 0.00 5.00 1.00 4.50 1.00 4.50 0.00
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-04-01 07:42:11, Gzip enabled