邮票问题
Description
设有已知面额的邮票m种,每种有n张,用总数不超过n张的邮票,能从面额1开始,最多连续组成多少面额。
(1≤m≤100,1≤n≤100,1≤邮票面额≤255)
Input
包含多组测试数据,每组测试数据包含2行。
第一行包括2个整数m和n的值。
第二行有m个整数,表示各种名额的值。
数据之间用一个空格隔开。
Output
每组测试数据包含1个整数,即连续面额数的最大值。
Sample Input
3 4
1 2 4
Sample Output
14
#include<bits/stdc++.h>
using namespace std;
int main(){
long long m,n,i,j,k,pieces[30001],x