Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;int cost[100]={};//int mincost = 10000;int profit[100] = {};int targetcost = 0;int maxprofit = 0;int minprofit = 2147483647;int totalprofit = 0;int N,M,K,T;void work(int now, int totalcost, int targetcost, int profit1){if(totalcost >= targetcost) {if(profit1<minprofit) minprofit = profit1;return;}for(int i=now;i<M;i++){if(cost[i] == 0) continue;work(i, totalcost+cost[i], targetcost, profit1+profit[i]);}return;}int main(){int Q;cin>>Q;for(int i=0;i<Q;i++){