Question 1: focal length time limit: 256 ms single point time limit: Ms memory limit: MB
Description
In general, we adopt a pinhole camera model, that is, we think it uses the principle of small hole imaging.
In the camera coordinate system, the unit length we use is generally not an international unit such as "meter", but the length of adjacent pixels. The focal length in the camera coordinate system is a very important physical quantity in the field of image processing.
Suppose we have obtained the physical focal length (focal length) of the lens, the width of the camera film (CCD width), and the horizontal resolution (image width) of the photo Based on the camera parameters ), the formula is as follows:
Focal length in pixels = (image width in pixels) * (focal length on earth)/(CCD width on earth)
For example, for Canon PowerShot 100
Focal length in pixels = 1600 pixels * 5.4/5.27 = 1639.49 pixels
Now, please write a common program to solve the size of the focal length in the camera coordinate system.
Input
Multiple groups of test data. The first is a positive integer T, indicating the number of test data groups.
Each group of test data occupies one row, which is
Physical focal length of the lens (focal length on earth)
CCD width on earth)
The image width in pixels.
Are separated by a space.
Output
Each group of data outputs a row in the format of "Case X: Ypx ". X indicates the number of the test data, starting from 1. Y indicates the size of the focal length in the camera coordinate system (focallength in pixels). Valid digits after the decimal point are retained and rounded.
Data range
For small data: focal length on earth and CCD width on earth are both in millimeters (mm)
For big data: the unit of length may also be meters (m), meters (dm), centimeters (cm), millimeters (mm), micron (um), nano (nm)
-
Sample Input
-
25.4mm 5.27mm 1600px5400um 0.00527m 1600px
-
Sample output
-
Case 1: 1639.47pxCase 2: 1639.47px
Question 2: tree time limit: 256 ms single point time limit: Ms memory limit: MB
Description
There is a tree with N nodes, where point 1 is the root. The initial vertex weights are all 0.
The depth of a node is defined as the depth of its parent node plus 1 ,. Specifically, the root node depth is defined as 1.
Now you need to support a series of the following operations: To the child tree of node u, the weight of the node whose depth is between l and r (the depth is still calculated from the root node of the entire tree) is added with a delta number.
After all the operations are completed, the value of each node is displayed.
To reduce the overhead caused by huge output, assume that after all operations are completed, the weights of each node are answer [1 .. n]. Calculate a Hash value as follows (select an appropriate data type and avoid overflow ). In the end, you only need to output this Hash value.
MOD = 1000000007; // 10 ^ 9 + 7
MAGIC = 12347;
Hash = 0;
For I = 1 to N do
Hash = (Hash * MAGIC + answer [I]) mod;
EndFor
Input
The first line is an integer T (1 ≤ T ≤ 5), indicating the number of data groups.
Next, there is no blank line between the input data of the T group and the test data.
The data format of each group is as follows:
The first line is an integer N (1 ≤ N ≤ 105), indicating the total number of nodes in the tree.
In the next N-1 row, the number of each line is 1, and the number of Father's Day points of nodes 2. N is displayed in sequence.
The next integer Q (1 ≤ Q ≤ 105) indicates the total number of operations.
In the next Q row, there are four integers in each row: u, l, r, delta (1 ≤ u ≤ N, 1 ≤ l ≤ r ≤ N,-109 ≤ delta ≤ 109 ), indicates an operation.
Output
For each group of data, first output a line "Case x:", x indicates the group of data, and then the Hash value of this group of data answers.
Data range
Small Data: 1 ≤ N, Q ≤ 1000
Big Data: 1 ≤ N, Q ≤ 105
Example
The subtree of vertex 1 has three nodes: 1, 2, and 3. The depth between 2 and 3 is between 2 and 3.
The subtree of vertex 2 has two or three nodes. There is no node with a depth of 1.
Therefore, after all operations are performed, the weights of only two or three points increase by 1. That is, the answer is 0 1 1. Then calculate the corresponding Hash value.
-
Sample Input
-
131221 2 3 12 1 1 1
-
Sample output
-
Case 1: 12348
Question 3: Activity Center time limit: 256 ms single point time limit: Ms memory limit: MB
Description
City A is A highly planned city, but residents cannot forget to exercise and exercise in high-tech areas, therefore, when designing City A, the Urban Planning Bureau should also consider building an activity center for residents so that residents living in City A can exercise and exercise their bodies and minds at any time.
The City Planning Bureau wants the location of the activity center to meet the following conditions:
1. The total distance to all places of residence is the smallest.
2. To facilitate resource supply and maintenance of other equipment in the activity center, the activity center must be built on the main road of City.
To simplify the problem, we put City A on A two-dimensional plane. The main road of the city is regarded as the X axis of the Cartesian coordinate system, and all the places of residence in the city can be considered as A point on the two-dimensional plane.
Now, City Planning Bureau A wants to know where the activity center is best.
Input
The first row contains a number T, indicating the number of data groups.
Next, it contains the T group of data. The first row of each group contains an integer N, indicating that there are N places of residence in City.
The next N rows represent the coordinates of each place of residence.
Output
For each group of data, a row "Case X: Y" is output. X indicates the number of each group of data (starting from 1), and Y indicates the optimal construction position of the activity center. We recommend that you retain the value of Y to 6 digits or more after the decimal point. Any result with an absolute error or relative error less than 10-6 from the standard answer will be considered correct.
Data range
Small Data: 1 ≤ T ≤ 1000, 1 ≤ N ≤ 10
Big Data: 1 ≤ T ≤ 10, 1 ≤ N ≤105
For all data, the coordinate value is an integer and the absolute value cannot exceed 106
Example
Example 1: the optimal construction position of the activity center is (1.678787, 0)
-
Sample Input
-
131 12 23 3
-
Sample output
-
Case 1: 1.678787