首页 > 代码库 > Pascal之工种问题

Pascal之工种问题

 1 program Project2;
 2 Type
 3   ma=(A,B,C);
 4   wk=1..3;
 5   const
 6   x:array[ma,wk] of integer
 7     =((4,3,3),(2,4,3),(4,5,2));
 8 var
 9   maxefficiency:array[wk] of wk;
10   i,j,k:wk;
11   s:integer;
12   m:integer;
13 
14 {$APPTYPE CONSOLE}
15 begin
16   { TODO -oUser -cConsole Main : Insert code here }
17   m:=0;
18   for i:=1 to 3 do
19    for j:=1 to 3 do
20    if i<>j then
21     begin
22     k:=6-i-j;
23     s:=x[A,i]+x[B,j]+x[C,k];
24      if s>m then
25       begin
26       m:=s;
27       maxefficiency[1]:=i;
28       maxefficiency[2]:=j;
29       maxefficiency[3]:=k;
30       end;
31       end;
32       for i:=1 to 3 do
33       writeln(工人:6,chr(64+i),工种:6,maxefficiency[i]);
34       writeln(最大效益 :12,m:4);
35       readln;
36       end.

技术分享

技术分享

Pascal之工种问题