10176_BeefMcNuggets

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

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

Pro.ID

10176

Title

Beef McNuggets

Title链接

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

AC

15

Submit

54

Ratio

27.78%

时间&空间限制

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

    Farmer Brown's cows are up in arms, having heard that McDonalds is considering the introduction of a new product: Beef McNuggets. The cows are trying to find any possible way to put such a product in a negative light.

    One strategy the cows are pursuing is that of 'inferior packaging'. "Look," say the cows, "if you have Beef McNuggets in boxes of 3, 6, and 10, you can not satisfy a customer who wants 1, 2, 4, 5, 7, 8, 11, 14, or 17 McNuggets. Bad packaging: bad product."

    Help the cows. Given N (the number of packaging options, 1 ≤ N ≤ 10), and a set of N positive integers (1 ≤ i ≤ 256) that represent the number of nuggets in the various packages, output the largest number of nuggets that can not be purchased by buying nuggets in the given sizes. Print 0 if all possible purchases can be made or if there is no bound to the largest number.

    The largest impossible number (if it exists) will be no larger than 2,000,000,000.

    输入

    Multiple test cases. For each case :

    Line 1:   N, the number of packaging options

    Line 2..N+1:   The number of nuggets in one kind of box

    输出

    Description

    Farmer Brown's cows are up in arms, having heard that McDonalds is considering the introduction of a new product: Beef McNuggets. The cows are trying to find any possible way to put such a product in a negative light.

    One strategy the cows are pursuing is that of 'inferior packaging'. "Look," say the cows, "if you have Beef McNuggets in boxes of 3, 6, and 10, you can not satisfy a customer who wants 1, 2, 4, 5, 7, 8, 11, 14, or 17 McNuggets. Bad packaging: bad product."

    Help the cows. Given N (the number of packaging options, 1 ≤ N ≤ 10), and a set of N positive integers (1 ≤ i ≤ 256) that represent the number of nuggets in the various packages, output the largest number of nuggets that can not be purchased by buying nuggets in the given sizes. Print 0 if all possible purchases can be made or if there is no bound to the largest number.

    The largest impossible number (if it exists) will be no larger than 2,000,000,000.

    Input

    Multiple test cases. For each case :

    Line 1:   N, the number of packaging options

    Line 2..N+1:   The number of nuggets in one kind of box

    Output

    For each case, output a single line containing a single integer that represents the largest number of nuggets that can not be represented or 0 if all possible purchases can be made or if there is no bound to the largest number.

    Sample Input

    3
    3
    6
    10

    Sample Output

    17

    Source

    样例输入

    3
    3
    6
    10

    样例输出

    17

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部