Das aktuelle QOTW klingt recht spannend, finde ich:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
You will write a program to perform scheduling. As we all
know, tasks sometimes take longer than expected. Sometimes
when this happens, the final deadline of the project is
affected; sometimes it isn't. For example, consider the four
tasks A, B, C, and D. B and C depend on A, which means that
they cannot be started until A is finished. D depends on B and
C, and cannot be started until both B and C are finished:
.-> B .
A :-> D
`-> C '
Suppose we expect the four tasks to take the following times:
A: 1 day
B: 2 days
C: 3 days
D: 1 day
Then we don't expect the project to be finished for at least 5
days: one day to complete A and start C; 3 days to complete C
and start D, and another day to finish D. Any delay in any of
the three tasks A, C, or D will cause the completion date to
slip. We say that A, C, and D are on the "critical path".
But B is not on the critical path, because B can go on while C
is going on, and can take up to one day longer than expected
without delaying the start of D.
You will write a program which will calculate critical paths. The
input to the program will be a file in the following format:
A 1
B 2 A
C 3 A
D 1 B C
FINAL 0 D
Each line represents one task. The first field in each line
is the name of the task. The second field is the expected
duration. If there are any other fields, they are the names
of other tasks which must be finished before this task can
start.
The program will find all the tasks on the critical path to
the task named FINAL and will print them out, one per line.
It may happen that the input specifies tasks that cannot possibly be
completed. For example:
A 1 B
B 1 A
FINAL 0 A B
Here A can't start until B is finished, but B can't start until A is
finished. In such cases, the program should diagnose an error.
Bitte keine Lösungen oder Spoiler vor Ablauf von 60 Stunden ab dem Zeitpunkt "Thu, 05 Aug 2004 11:44:43 -0400" posten, da vielleicht einige aus dem Forum dort mitmachen.
Nur als hint: Golflösungen sind in dem Zirkel nicht gern gesehen (warum auch immer), mein Hangman kam überall gut an, aber dort nicht.
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;
use strict; use warnings; Link zu meiner Perlseite