Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 5759f4af authored by fengg's avatar fengg

init

parents
Pipeline #7254 failed with stages
in 1 minute and 3 seconds
Projet de Nagih
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
对于每个人 不能连休息两个周末 不能连续休息三天 周一到周五随机选一天休息
rt一天的月假 也不能连着三天
一个月一天工作不给钱的 随机 不能在周末
工作周末 每个周末至少三个人在早上工作
每个工作周末和休息日之间添加工作日
\ No newline at end of file
#include <iostream>
#include <cstdlib>
using namespace std;
char schedule[11][28];
//first step : poser les RH
for(int i=0;i<11;i++){
if(i%2==0){
schedule[i][12]='RH'; // pair number -> 13 14 27 28
schedule[i][13]='RH';
schedule[i][26]='RH';
schedule[i][27]='RH';
}
else{
schedule[i][5]='RH'; // impair number -> 6 7 20 21
schedule[i][6]='RH';
schedule[i][19]='RH';
schedule[i][20]='RH';
}
}
// poser le RH (1 jour pour chaque semaine entre lundi et vendredi), mais pas 3 jours successifs
int a = 0;
int b = 4; // to generate a random between 0 and 4
int c = (rand() % (b-a+1))+a; c<28; c = c+7;
for(int s = 0; s<4; s++)
for(int i=0;i<11;i++){
while(1){
int j = c+s*7;
if (schedule[i][j-2]==schedule[i][j-1]=='RH' || schedule[i][j+2]==schedule[i][j+1]=='RH'){
c = (rand() % (b-a+1))+a;
}
else{
schedule[i][j] = 'RH';
break;
}
}
}
}
cout<< schedule;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment