p1057.dpr

来自「高手写的所有acm例程 在acm.zju.edu.cn 上的题目的例程」· DPR 代码 · 共 39 行

DPR
39
字号
program p1057;

{$APPTYPE CONSOLE}
var
        n       :integer;
        showa,showb     :array[1..20]of longint;
        geta,getb       :longint;
        i       :Integer;

PROCEDURE add(p:integer);
begin
if (showa[p]=1)and(showb[p]=2) then inc(geta,6) else
if (showa[p]=2)and(showb[p]=1) then inc(getb,6) else
if (showa[p]-showb[p]=1) then inc(getb,showa[p]+showb[p]) else
if (showb[p]-showa[p]=1) then inc(geta,showa[p]+showb[p]) else
if (showb[p]>showa[p]) then inc(getb,showb[p]) else
if (showa[p]>showb[p]) then inc(geta,showa[p]);
end;


begin
readln(n);
while n<>0 do
        begin
        for I:=1 to n do read(showa[i]);
        readln;
        for i:=1 to n do read(showb[i]);
        readln;
        geta:=0;
        getb:=0;
        for i:=1 to n do add(i);
        writeln('A has ',geta,' points. B has ',getb,' points.');
        readln(n);
        if n<>0 then writeln;
        end;


end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?