Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
25
Task/ABC-Problem/PL-I/abc-problem-1.pli
Normal file
25
Task/ABC-Problem/PL-I/abc-problem-1.pli
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
ABC: procedure options (main); /* 12 January 2014 */
|
||||
|
||||
declare word character (20) varying, blocks character (200) varying initial
|
||||
('((B O) (X K) (D Q) (C P) (N A) (G T) (R E) (T G) (Q D) (F S)
|
||||
(J W) (H U) (V I) (A N) (O B) (E R) (F S) (L Y) (P C) (Z M))');
|
||||
declare tblocks character (200) varying;
|
||||
declare (true value ('1'b), false value ('0'b), flag) bit (1);
|
||||
declare ch character (1);
|
||||
declare (i, k) fixed binary;
|
||||
|
||||
do word = 'A', 'BARK', 'BOOK', 'TREAT', 'COMMON', 'SQuAd', 'CONFUSE';
|
||||
flag = true;
|
||||
tblocks = blocks;
|
||||
do i = 1 to length(word);
|
||||
ch = substr(word, i, 1);
|
||||
k = index(tblocks, uppercase(ch));
|
||||
if k = 0 then
|
||||
flag = false;
|
||||
else /* Found a block with the letter on it. */
|
||||
substr(tblocks, k-1, 4) = ' '; /* Delete the block. */
|
||||
end;
|
||||
if flag then put skip list (word, 'true'); else put skip list (word, 'false');
|
||||
end;
|
||||
|
||||
end ABC;
|
||||
Loading…
Add table
Add a link
Reference in a new issue