1.
var
i,a,b,c,d:integer;
f:array[0..3] of integer;
begin
for i:=0 to 3 do
read(f[i]);
a:=f[0]+f[1]+f[2]+f[3];
a:=a div f[0];
b:=f[0]+f[2]+f[3];
c:=(b*f[1]+a) div f[2];
d:=f[(b div c) mod 4];
if (f[(a+b+c+d) mod 4]>f[2]) then
begin
a:=a+b;
writeln(a)
end
else
begin
c:=c+d;
writeln(c);
end;
end.
输入: 9 19 29 39
输出:23
2.
procedure foo(a,b,c:integer);
begin
if a>b then foo(c,a,b)
else
writeln(a,',',b,',',c)
end;
var a,b,c:integer;
begin
readln(a,b,c);
foo(a,b,c);
end.
输入:2 1 3
输出:1,3,2
3.
procedure f(a,b,c:integer);
begin
write(a,b,c,'/');
if (a=3)and(b=2)and(c=1) then exit;
if (b<c) then f(a,c,b)
else
if a<b then
if a<c then f(c,a,b) else f(b,c,a);
end;
var a,b,c:integer;
begin
readln(a,b,c);
f(a,b,c);
end.
输入:1 3 2
输出:132/213/231/312/321/
4.
var
s:string;
i,j,len,k:integer;
begin
readln(s);
len:=length(s);
for i:=1 to len do
if (ord(s[i])>=ord('A')) and (ord(s[i])<=ord('Z')) then
s[i]::=chr(ord(s[i])-ord('A')+ord('a'));
for i:=1 to len do
if (ord(s[i])<ord('x')) then s:=chr(ord(s[i])+3)
else
s[i]:=chr(ord(s[i])-23);
write(s);
write('/');
for j:=1 to 3 do
begin
i:=1;
while i<=len-j do
begin
s[i]:=s[i+j];
i:=i+j;
end;
end;
writeln(s);
end.
输入:ABCDEFGuvwxyz
输出:defghijxyzabc/hfizxjaybcccc