10142_MoneySystems

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

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

Pro.ID

10142

Title

Money Systems

Title链接

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

AC

63

Submit

323

Ratio

19.50%

时间&空间限制

  • Time Limit: 400/200 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    The cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Traditionally, coins come in values like 1, 5, 10, 20 or 25, 50, and 100 units, sometimes with a 2 unit coin thrown in for good measure.

    The cows want to know how many different ways it is possible to dispense a certain amount of money using various coin systems. For instance, using a system of {1, 2, 5, 10, ...} it is possible to create 18 units several different ways, including: 18×1, 9×2, 8×2+2×1, 3×5+2+1, and many others.

    Write a program to compute how many ways to construct a given amount of money using supplied coinage. It is guaranteed that the total will fit into both a signed long long (C/C++) and Int64 (Free Pascal).

    输入

    Multiple test cases. Each case as follow:

    The number of coins in the system is V ( 1 ≤ V ≤ 25 ).

    The amount money to construct is N ( 1 ≤ N ≤ 10000 ).

    Line 1: Two integers, V and N

    Lines 2..: V integers that represent the available coins (no particular number of integers per line)

    输出

    Description

    The cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Traditionally, coins come in values like 1, 5, 10, 20 or 25, 50, and 100 units, sometimes with a 2 unit coin thrown in for good measure.

    The cows want to know how many different ways it is possible to dispense a certain amount of money using various coin systems. For instance, using a system of {1, 2, 5, 10, ...} it is possible to create 18 units several different ways, including: 18×1, 9×2, 8×2+2×1, 3×5+2+1, and many others.

    Write a program to compute how many ways to construct a given amount of money using supplied coinage. It is guaranteed that the total will fit into both a signed long long (C/C++) and Int64 (Free Pascal).

    Input

    Multiple test cases. Each case as follow:

    The number of coins in the system is V ( 1 ≤ V ≤ 25 ).

    The amount money to construct is N ( 1 ≤ N ≤ 10000 ).

    Line 1: Two integers, V and N

    Lines 2..: V integers that represent the available coins (no particular number of integers per line)

    Output

    For each case, output a single line containing the total number of ways to construct N money units using V coins.

    Sample Input
    3 10
    1 2 5
    Sample Output

    10

    Source

    样例输入

    3 10
    1 2 5

    样例输出

    10

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部