예제 #1
0
파일: exemple.c 프로젝트: Sun42/piscine
int main(void)
{
        char tab[8] = {9, 9, 9, 9, 9, 9, 9, 9};
 
        printf("Les 8 reines peuvent se r	soudre de %d m	thodes\n", recu(tab, 0));
        return 0;
}
예제 #2
0
int recu(int num){
	
	printf("Stack: %d, ESP: %d, Iteration: %d\n", getStack((int)(getp()->stack)), getp()->esp, num);
	int a[200];
	a[2] = 1;
	if(num == 0){
		return 1;
	}
	else if( num%5 ){
		softyield();
	}
	recu(num-1);
	return 1;
}
예제 #3
0
파일: planta.cpp 프로젝트: aaronson/AED2
Planta::Planta(const Workflow& w, const recursos& r){
	Usorecursos recu(r);
	this->recs = recu;
	this->wkf = w;
	int i = 0;
	unsigned int n = this->wkf.cantidadTareas();
	priotar* ap = new priotar[n];
	
	while (i < n){
		ap[i].tarea = i;
		ap[i].prioridad = this->wkf.prioridad(i);
		i++;
	}
	i = n/2 -1;
	//cout << i << endl << n << endl;
	while (i >= 0){
		heapifyP(ap, i, n);
		i--;
	}
	i = 0;
	Secu<priotar> s;
	Secu<priotar>::iterador it = s.crearIt();
	while (i < n){
		it.agregarAtrasDeIt(ap[0]);
		ap[0].prioridad = 0;
		heapifyP(ap, 0, n);
		i++;
	}
	it.retrocederAlPrincipio();
	Secu<unsigned int>* asuc = new Secu<unsigned int>[n];
	
	while (it.hayMas()){
		i = it.actual().tarea;
		Conj<unsigned int>::const_iterador itpred = this->wkf.predecesoras(i).crearIt();
		while (itpred.hayMas()){
			asuc[itpred.actual()].agregarAtras(i);
			//cout << itpred.actual() << " " << asuc[itpred.actual()] << endl;
			itpred.avanzar();
		}
		it.avanzar();
	}
	this->sucesores = asuc;
	delete [] ap;
}
// FIXME: Use OEvent::fromMap() which makes this obsolete.. (eilers)
void ODateBookAccessBackend_XML::finalizeRecord( OEvent& ev ) {
    /* AllDay is alway in UTC */
    if ( ev.isAllDay() ) {
        OTimeZone utc = OTimeZone::utc();
        ev.setStartDateTime( utc.fromUTCDateTime( start ) );
        ev.setEndDateTime  ( utc.fromUTCDateTime( end   ) );
        ev.setTimeZone( "UTC"); // make sure it is really utc
    } else {
        /* to current date time */
        // qWarning(" Start is %d", start );
        OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() );
        QDateTime date = zone.toDateTime( start );
        qWarning(" Start is %s", date.toString().latin1() );
        ev.setStartDateTime( zone.toDateTime( date, OTimeZone::current() ) );

        date = zone.toDateTime( end );
        ev.setEndDateTime  ( zone.toDateTime( date, OTimeZone::current()   ) );
    }
    if ( rec && rec->doesRecur() ) {
        OTimeZone utc = OTimeZone::utc();
        ORecur recu( *rec ); // call copy c'tor;
        recu.setEndDate ( utc.fromUTCDateTime( rp_end ).date() );
        recu.setCreatedDateTime( utc.fromUTCDateTime( created ) );
        recu.setStart( ev.startDateTime().date() );
        ev.setRecurrence( recu );
    }

    if (alarmTime != -1 ) {
        QDateTime dt = ev.startDateTime().addSecs( -1*alarmTime*60 );
        OPimAlarm al( snd ,  dt  );
        ev.notifiers().add( al );
    }
    if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) {
        qWarning("already contains assign uid");
        ev.setUid( 1 );
    }
    qWarning("addind %d %s", ev.uid(), ev.description().latin1() );
    if ( ev.hasRecurrence() )
        m_rep.insert( ev.uid(), ev );
    else
        m_raw.insert( ev.uid(), ev );

}
예제 #5
0
파일: exemple.c 프로젝트: Sun42/piscine
int recu(char *tab, int line)
{
        static int solution = 0;
        int cas;
 
        if (line == 8) {
                aff(tab);
                return ++solution;
        }
 
        for (cas = 0; cas < 8; cas++) {
                if (!is_valid(tab, line, cas)) {
                        tab[line] = cas;          
                        recu(tab, line + 1);
                        tab[line] = 9;
                }
        }
 
        return solution;
}
예제 #6
0
// Just to have more functions in the autocomplete
int _test2(int size, char** args) {
	printf("AOAOAOA");
	return recu(500);
}