22486_FollowtheFoldingDo

2022-5-16 18:22| 发布者: Hocassian| 查看: 26| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506484770100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22486

Title

Follow the Folding Dot

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22486

AC

2

Submit

3

Ratio

66.67%

时间&空间限制

  • Time Limit: 300/100 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Write a program that will keep track of the location of a dot on a piece of paper as it is being folded.

    输入

    The input file will contain 4 different types of records.

    Type 1 will contain two real numbers separated by one space. These are, respectively, the width and height of the paper.

    Type 2 will contain two real numbers and a character, all separated by one space. These numbers represent the coordinates of the dot on the paper. The first number is the distance horizontally from the upper left hand corner. The second is the distance down from the upper left hand corner. The character will tell you which side of the paper the dot is on (T for top, B for bottom).

    Type 3 will contain two unseparated uppercase characters. The first character will tell you which of the four sides of the paper you are about to use (T for top, B for bottom, L for left, R for right). The second character will tell you whether to fold the paper over the top or under the bottom (O for over, U for under) e.g., TO, would mean you take the top of the paper and fold it over. Remember that the upper left hand corner is always 0, 0.

    Type 4 will contain one uppercase 'S'. This will tell you to stop folding the paper.

    输出

    Description
    Write a program that will keep track of the location of a dot on a piece of paper as it is being folded.
    Input

    The input file will contain 4 different types of records.

    Type 1 will contain two real numbers separated by one space. These are, respectively, the width and height of the paper.

    Type 2 will contain two real numbers and a character, all separated by one space. These numbers represent the coordinates of the dot on the paper. The first number is the distance horizontally from the upper left hand corner. The second is the distance down from the upper left hand corner. The character will tell you which side of the paper the dot is on (T for top, B for bottom).

    Type 3 will contain two unseparated uppercase characters. The first character will tell you which of the four sides of the paper you are about to use (T for top, B for bottom, L for left, R for right). The second character will tell you whether to fold the paper over the top or under the bottom (O for over, U for under) e.g., TO, would mean you take the top of the paper and fold it over. Remember that the upper left hand corner is always 0, 0.

    Type 4 will contain one uppercase 'S'. This will tell you to stop folding the paper.

    Output

    The output will consist of which piece of paper you are working on, the beginning size of the paper, the beginning location of the dot, the size of the paper and the location of the dot when you have finished folding the paper.

    Process

    This is best explained by an example.

    Place a 8.5x11 paper on the desk in front of you. Place a dot on the top surface at 1.00 unit right of the top left corner and 2.00 units down from the top. Now, take the top edge of the paper and fold it over the top. The paper is now 8.5x5.5 and the dot is on the bottom of page 1. The location of the new position of the dot is 3.5 units from the top and 1.00 units to the right. Use these new 'coordinates' as the starting positions for the next set of folding instructions.

    Sample Input
    5.0 8.25
    3.25 8.00 T
    TO
    LU
    S
    1.0 2.0
    0.55 1.3 B
    LO
    S
    Sample Output
    Paper number 1
    Beginning paper dimensions 5.000000 X 8.250000
    Dot is on TOP of page 1. Position: 3.250000 X 8.000000
    
    After folding paper. Paper dimensions: 2.500000 X 4.125000
    Dot is on TOP of page 2. Position 0.750000 X 3.875000
    
    Paper number 2
    Beginning paper dimensions 1.000000 X 2.000000
    Dot is on BOTTOM of page 1. Position: 0.550000 X 1.300000
    After folding paper. Paper dimensions: 0.500000 X 2.000000
    Dot is on BOTTOM of page 2. Position 0.050000 X 1.300000
    Hint
    1. The dot will never be on the edge of the paper or a fold line.
    2. When folding the paper, pretend you are cutting the paper. In other words, don't be concerned about the thickness of the fold.
    3. All input characters will be in uppercase.
    Source

    样例输入

    5.0 8.25
    3.25 8.00 T
    TO
    LU
    S
    1.0 2.0
    0.55 1.3 B
    LO
    S

    样例输出

    Paper number 1
    Beginning paper dimensions 5.000000 X 8.250000
    Dot is on TOP of page 1. Position: 3.250000 X 8.000000
    
    After folding paper. Paper dimensions: 2.500000 X 4.125000
    Dot is on TOP of page 2. Position 0.750000 X 3.875000
    
    Paper number 2
    Beginning paper dimensions 1.000000 X 2.000000
    Dot is on BOTTOM of page 1. Position: 0.550000 X 1.300000
    After folding paper. Paper dimensions: 0.500000 X 2.000000
    Dot is on BOTTOM of page 2. Position 0.050000 X 1.300000

    提示

    1. The dot will never be on the edge of the paper or a fold line.
    2. When folding the paper, pretend you are cutting the paper. In other words, don't be concerned about the thickness of the fold.
    3. All input characters will be in uppercase.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部