#include #include #include #include void primes(std::vector&prime_list, int n) { prime_list.resize(n - 2); for (int i = 2; in)break; ++front_index; } } struct Node { int count_; Node*next_; }; void run(Node*node_list, int length, std::vector&cs,int value) { int now=node_list[value].count_; for (auto v : cs) { if (length > v + value&&node_list[v+value].count_count_=index; index++; now_node=now_node->next_; } run(node_list,length,cs,value+v); } } } int buy(Node*node_list, std::vector&prime_list,int maney,std::vector&cs) { int sum=0; for (auto v : prime_list) { if (node_list[maney-v].count_ > 0) { sum+=node_list[maney - v].count_; } } sum+=maney/ cs[0]; return sum; } //100 //6 //10 2 4 7 8 1 int main() { int n, m; std::cin >> m >> n; std::vector cs(n); for (int i = 0; i> cs.at(i); } std::sort(cs.begin(),cs.end()); std::vector prime_list; Node*node_list=new Node[m]; for (int i = 0; i < m;i++) { node_list[i].count_=-1; node_list[i].next_ = nullptr; } node_list[0].count_=0; run(node_list,m,cs,0); primes(prime_list, m); std::cout<