[Offer收割]编程练习赛1 register

Ended

Participants:955

Verdict:Wrong Answer
Score:0 / 100
Submitted:2016-03-06 16:59:53

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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++){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX