Browse Source

week6 ex3

master
RinRi 1 year ago
parent
commit
dd5e44bf05
2 changed files with 3 additions and 2 deletions
  1. +3
    -2
      week06/ex3.c
  2. BIN
      week06/ex3.out

+ 3
- 2
week06/ex3.c View File

@@ -65,8 +65,9 @@ int main() {
jd++; jd++;
} }
} }

for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
if (curt >= p[i].at) {
if (curt >= p[i].at && p[i].used == 0) {
ready[qsz++] = i; ready[qsz++] = i;
p[i].used = 1; p[i].used = 1;
} }
@@ -78,7 +79,7 @@ int main() {


if (qsz == 0) { if (qsz == 0) {
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
if (p[i].used != 0) {
if (p[i].used == 0) {
ready[qsz++] = i; ready[qsz++] = i;
p[i].used = 1; p[i].used = 1;
curt = p[i].at; curt = p[i].at;


BIN
week06/ex3.out View File


Loading…
Cancel
Save