22102_GiantScreen

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

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

Pro.ID

22102

Title

Giant Screen

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    You are working in Advanced Computer Monitors (ACM), Inc. The company is building and selling giant computer screens that are composed from multiple smaller screens. Your are responsible for design of the screens for your customers.

    Customers order screens of the specifi ed horizontal and vertical resolution in pixels and a specifi ed horizontal and vertical size in millimeters. Your task is to design a screen that has a required resolution in each dimension or more, and has required size in each dimension or more, with a minimal possible price. The giant screen is always built as a grid of monitors of the same type. The total resolution, size, and price of the resulting screen is simply the sum of resolutions, sizes, and prices of the screens it is built from.

    You have a choice of regular monitor types that you can order and you know their resolutions, sizes, and prices. The screens of each type can be mounted both vertically and horizontally, but the whole giant screen must be composed of the screens of the same type in the same orientation. You can use as many screens of the chosen type as you need.

    输入

    The first line of the input file contains four integer numbers rh, rv, sh, and sv (all from 100 to 10000 inclusive) --- horizontal and vertical resolution and horizontal and vertical size of the screen you have to build, respectively. The next line contains a single integer number n (1 ≤ n ≤ 100) --- the number of different screen types available to you. The next n lines contain descriptions of the available screen types.

    Each description occupies one line and consists of five integer numbers ---- rh,i , rv,i , sh,i , sv,i , pi (all from 100 to 10000 inclusive), where first four numbers are horizontal and vertical resolution and horizontal and vertical size of i-th screen type, and pi is the price.

    输出

    Description

    You are working in Advanced Computer Monitors (ACM), Inc. The company is building and selling giant computer screens that are composed from multiple smaller screens. Your are responsible for design of the screens for your customers.

    Customers order screens of the specifi ed horizontal and vertical resolution in pixels and a specifi ed horizontal and vertical size in millimeters. Your task is to design a screen that has a required resolution in each dimension or more, and has required size in each dimension or more, with a minimal possible price. The giant screen is always built as a grid of monitors of the same type. The total resolution, size, and price of the resulting screen is simply the sum of resolutions, sizes, and prices of the screens it is built from.

    You have a choice of regular monitor types that you can order and you know their resolutions, sizes, and prices. The screens of each type can be mounted both vertically and horizontally, but the whole giant screen must be composed of the screens of the same type in the same orientation. You can use as many screens of the chosen type as you need.

    Input

    The first line of the input file contains four integer numbers rh, rv, sh, and sv (all from 100 to 10000 inclusive) --- horizontal and vertical resolution and horizontal and vertical size of the screen you have to build, respectively. The next line contains a single integer number n (1 ≤ n ≤ 100) --- the number of different screen types available to you. The next n lines contain descriptions of the available screen types.

    Each description occupies one line and consists of five integer numbers ---- rh,i , rv,i , sh,i , sv,i , pi (all from 100 to 10000 inclusive), where first four numbers are horizontal and vertical resolution and horizontal and vertical size of i-th screen type, and pi is the price.

    Output

    Write to the output file a single integer --- the minimal price of the specified giant screen.

    Sample Input

    Sample #1
    1024 1024 300 300
    3
    1024 768 295 270 200
    1280 1024 365 301 250
    1280 800 350 270 210


    Sample #2
    2400 2000 800 700
    3
    1024 768 295 270 200
    1280 1024 365 301 250
    1280 800 350 270 210

    Sample Output

    Sample #1
    250

    Sample #2
    1260

    Source

    样例输入

    Sample #1
    1024 1024 300 300
    3
    1024 768 295 270 200
    1280 1024 365 301 250
    1280 800 350 270 210


    Sample #2
    2400 2000 800 700
    3
    1024 768 295 270 200
    1280 1024 365 301 250
    1280 800 350 270 210

    样例输出

    Sample #1
    250

    Sample #2
    1260

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部