求高手帮忙检查下为什么这个程序运行会发生错误
#include <iostream>using namespace std;
const int _maxbill= 10;
const int _maxmoney =5000;
int a[_maxbill][_maxmoney];
int x[_maxbill];
int exchange(int num, int money){
int min = 65535, number;
if(num == 1) return a[num-1][money]=money;
else {
number = money/x[num];
for(int i = 1; i <= number; i++){
int remain = money - x[i]*i;
if(a[i-1][remain]== -1) return exchange(i-1, remain);
else min = (min > a[i][remain])? a[i][remain] : min;
}
return a[num][money] = min;
}
}
int main() {
int n, money;
for(int i = 0; i<_maxbill; i++ )
for(int j = 0; j<_maxmoney; i++)
a[i][j]= -1;
for(int i = 0; i<_maxbill; i++ )
x[i] = -1;
cout<<"请输入钱币的种类数:"<<endl;
cin>>n;