identification division.
program-id. pebbles.
author. "Reisig/ PN Newsletter 10-05 p. 3".
* ursprünglich von E. W. Diijkstra
date-written. 22.11.2005.
date-compiled.
data division.
working-storage section.
77 b pic 9(4).
77 w pic 9(4).
linkage section.
77 BB pic 9(4).
77 WW pic 9(4).
procedure division using BB WW.
* computes solutions for the pebble game
move BB to b
move WW to w
perform until false
if w>=1 and b>=1
subtract 1 from b
else if b>=2 then
subtract 1 from b
else if w>=2 then
subtract 2 from w
add 1 to b
end-if end-if end-if
end-perform.
display "b="b" w="w.
end-program pebbles.
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|