The beauty of programming the first focal length of the preliminary round

Source: Internet
Author: User
Question 1: focal length time limit: 256 ms single point time limit: Ms memory limit: MB
Description

In general, we use a pinhole camera model, that is, we think it uses the principle of small hole imaging.

In the camera coordinate system, in general, the unit length we use is not an international unit such as "meter", but the length of adjacent pixels. The focal length in the camera coordinate system is an important physical quantity in the field of image processing.

If we have obtained the physical focal length (focal length) of the lens, the width of the camera film (CCD width), and the image width ), the detailed 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 general program to solve the size of the focal length in the camera coordinate system.


Input

Multiple groups of trial data. The first is a positive integer T, indicating the number of groups of the trial data.

Each group of Token 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 trial 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 up.


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)



Example Input
25.4mm 5.27mm 1600px5400um 0.00527m 1600px
Example output
Case 1: 1639.47pxCase 2: 1639.47px

The beauty of programming the first focal length of the preliminary round

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.