1.
Program test1;
var a,b,c,ans:integer;
begin
readln(a,b);
c:=a+b;
a:=c-a;
ans:=a*b;
writeln('Ans=',ans);
end.
输入: 5 8
输出:Ans=64
2. program test2;
Var a,b:longint;
begin
readln (a, b) ;
if (a > b) then a := (a + b) div (a - b)
else a := (a - b) mod 3;
writeln (a) ;
end.
输入 1: 24 12
输入 2: 7 12
输出:3|-2
3.
program test3;
var n: integer;
function fun (n:integer):integer;
begin
if n=1 then exit(1)
else if n=2 then exit(2)
else if n=3 then exit(3)
else exit(fun(n-3)*fun(n-1));
end;
begin
readln(n);
writeln(fun(n));
end.
输入:7
输出:54
4.
program test4;
const max=20;
var a,b:array[1..max] of integer;
n:string; len,i,j,s:integer;
begin
readln(n);
len:=length(n);
i:=len; j:=1;
while i>0 do
begin
a[j]:=ord(n[i])-ord ('0') ;
inc (j) ; dec (i) ;
end;
s:=0;
for i:=1 to len do
if a[i]>=5 then inc(s) ;
writeln (s) ;
end.
输入: 387543284570123
输出:6
5.
program test5;
Var i, j, n, n1:longint ;
begin
readln (n) ;
i:=2; j:=0; n1:=n;
while n1<>1 do begin
while n1 mod i=0 do begin
inc (j) ;
if j=1 then write(n, '=',i)
else write ( '*' , i) ;
n1:=n1 div i;
end;
inc(i);
end;
end.
输入:102
输出:102=2*3*17