ac1269.pas
来自「这是在网络上搜集到的在东京大学的ACM上面解决的一些题目的源码」· PAS 代码 · 共 27 行
PAS
27 行
program tju1269;
const
maxn=10000;
var
a:array[1..maxn]of byte;
n,i,b,s1,s2,t:longint;
first:boolean;
begin
first:=true;
repeat
read(n);if n=0 then halt;
for i:=1 to n do read(a[i]);
s1:=0;s2:=0;
for i:=1 to n do begin
read(b);
if abs(a[i]-b)>1 then
if a[i]>b then inc(s1,a[i]) else inc(s2,b)
else if abs(a[i]-b)=1 then begin
t:=a[i]+b;if t=3 then t:=6;
if a[i]<b then inc(s1,t) else inc(s2,t);
end;
end;
if first then first:=false else writeln;
writeln(s1,' ',s2);
until false;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?