文件名称:series-sum
介绍说明--下载内容均来自于网络,请自行研究使用
数列求和(动态规划实现)
给定n个数字和一个范围[x,y],求从这n个数字中任意取出一些数字,使得它们的和在范围[x,y]中有多少种取法。
输入:
输入第一行为整数case,case<=10 表示有case组测试数据。
对于每一组测试数据,第一行为一个整数n (n<=30),第二行为n个整数a[i],第三行为两个整数x和y。其中,a[i]>=0,sum(a[i])<2^31,0<x,y<sum(a[i])< span="">。</x,y<sum(a[i])<>
输出:
对于每组数据输出一行,总的取法数。
样例输入:
2
3
1 2 4
1 7
3
1 2 4
2 5
样例输出:
7
4
-Series summation (dynamic programming) given n numbers and a range [x, y], seeking to remove any numbers from these n numbers such that their sum in the range [x, y] how much emulated . Input: input the first acts of integer CASE case < = 10 means that the case set of test data. For each set of test data, the first is an integer n (n < = 30), the second n integers a [i], the third two integers x and y. Wherein a [i]> = 0, the sum (a [i]) < 2 ^ 31,0 <x,y<sum(a[i])< span=""> . </x,y<sum(a[i])<> Output: For each set of data output line, the total number of emulated. Sample Input: 2 3 1 4 1 7 3 1 2 4 2 5 Sample Output: 74
给定n个数字和一个范围[x,y],求从这n个数字中任意取出一些数字,使得它们的和在范围[x,y]中有多少种取法。
输入:
输入第一行为整数case,case<=10 表示有case组测试数据。
对于每一组测试数据,第一行为一个整数n (n<=30),第二行为n个整数a[i],第三行为两个整数x和y。其中,a[i]>=0,sum(a[i])<2^31,0<x,y<sum(a[i])< span="">。</x,y<sum(a[i])<>
输出:
对于每组数据输出一行,总的取法数。
样例输入:
2
3
1 2 4
1 7
3
1 2 4
2 5
样例输出:
7
4
-Series summation (dynamic programming) given n numbers and a range [x, y], seeking to remove any numbers from these n numbers such that their sum in the range [x, y] how much emulated . Input: input the first acts of integer CASE case < = 10 means that the case set of test data. For each set of test data, the first is an integer n (n < = 30), the second n integers a [i], the third two integers x and y. Wherein a [i]> = 0, the sum (a [i]) < 2 ^ 31,0 <x,y<sum(a[i])< span=""> . </x,y<sum(a[i])<> Output: For each set of data output line, the total number of emulated. Sample Input: 2 3 1 4 1 7 3 1 2 4 2 5 Sample Output: 74
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ACM题目:数列求和(动态规划实现).txt
series_sum.cpp
series_sum.py