ВУЗ:
Составители:
Рубрика:
for (; i+1<vect->m_size; i++) {
*at_vect(i+1,vect) = *at_vect(i,vect)+1;
};
if (*at_vect(i,vect) < n) return ERR_OK;
return ERR_FAILED;
}
int TestCombination(struct t_matr *matr, struct t_vect *vect) {
int x,p;
struct t_vect excluded;
int excl_size;
alloc_vect(matr->m_xsize,&excluded);
excl_size=0;
for (p=0; p<vect->m_size; p++) {
for (x=0; x<matr->m_xsize; x++) {
if (*at_matr(x,*at_vect(p,vect),matr)) {
if (!*at_vect(x,&excluded)) {
excl_size++;
(*at_vect(x, &excluded)) ++;
};
};
};
};
free_vect(&excluded);
if (excl_size < matr->m_xsize) {
return ERR_FAILED;
} else {
return ERR_OK;
};
}
int SolvePrecise(struct t_matr* matr, struct t_vect* vect) {
int k,i;
alloc_vect(matr->m_ysize, vect);
for (k=1; k<matr->m_ysize; k++) {
vect->m_size=k;
for (i=0; i<k; i++) {
*at_vect(i,vect)=i;
};
do {
if (TestCombination(matr,vect)==ERR_OK) {
DBG(("Successful call to 'Solve'\n"));
return ERR_OK;
};
} while (GenCombination(matr->m_ysize, k, vect) ==
ERR_OK);
};
vect->m_size=0;
DBG(("Successful call to 'Solve'; no solution found!\n"));
return ERR_FAILED;
}
int CalcMarks(struct t_matr *matr, struct t_vect *vect, struct t_vect
*excl) {
int x,y;
Страницы
- « первая
- ‹ предыдущая
- …
- 35
- 36
- 37
- 38
- 39
- …
- следующая ›
- последняя »