#include
using namespace std;
struct Comm{
unsigned short price;
short dv;
short num;
};
Comm goods[111];
unsigned short succ[111][111];
short menu[111][111];
int price_min,dv_max,dv_min;
void good_min(int good_id,int good_price){
int i;
int temp_id,temp_price,lujing;
for (i = 0;i < goods[good_id].num;i++) {
temp_id = menu[good_id][i];
if (good_price <= price_min && goods[temp_id].dv <= dv_max && goods[temp_id].dv >= dv_min){
temp_price = good_price + succ[good_id][temp_id] + goods[temp_id].price;
price_min = price_min < temp_price ? price_min : temp_price;
lujing = good_price + succ[good_id][temp_id];
good_min(temp_id,lujing);
}
}
return;
}
int main(){
int limit,tot;
int i,j;
int temp_id,temp_price;
cin >> limit >> tot;
for (i = 1;i <= tot;i++) {
cin >> goods[i].price >> goods[i].dv >> goods[i].num;
for (j = 0;j < goods[i].num;j++) {
cin >> menu[i][j] >> temp_price;
temp_id = menu[i][j];
succ[i][temp_id] = temp_price;
}
}
price_min = goods[1].price;
dv_max = goods[1].dv + limit;
dv_min = goods[1].dv - limit;
good_min(1,0);
cout << price_min << endl;
return 0;
}
这段代码哪里有问题?用计算机运行了一下结果是正常的,但是北大网站一直提示错误,具体错在哪里?