# PASCAL入门测试12(附答案)

【输入】

【输出】

【样例输入】

3123243678

【样例输出】

47

【样例说明】

a

b

c

a

b

a

b

a

a

a

a

【数据规模】

50%的数据，1≤n≤50，所有边长为不超过100正整数。

100%的数据，1≤n≤100000，所有边长为不超过100000的正整数。var n,a,b,c,k,I,S:LONGint;

case k of

end;

end;

write('s=',s);

end.

250

3100130140

18090

1300500

3500600700

290

S=4670

1900010000

250000

280000

38000900010000

3200003000040000

135********

3300040005000

2500000

190009500

2678900

S=5599600

VAR

L,U,N,P,D,X,Y:INTEGER;

BEGIN

D:=0;

FOR X:=L TO U DO

BEGIN

N:=0;

FOR Y:=1TO X DO

IF X MOD Y=0THEN N:=N+1;

IF N>D THEN

BEGIN

P:=X;

D:=N;

END;

END;

WRITELN(P,'',D);

END.

9*1+7*3+8*1+0*3+9*1+2*3+1*1+4*3+1*1+8*3+9*1+4*3+8*1=120

var

c:char;

s,i,n,m:integer;

begin

s:=0;

for i:=1to13do begin

if odd(i)then m:=1else m:=3;

s:=s+m*(ord(c)-48);

end;

writeln(s);

end.

var

a,b,c,d,i,s:integer;

begin

for i:=b to b*d do

if(i mod b=0)and(i mod d=0)

then break;

a:=(i div b)*a;

c:=(i div d)*c;

s:=a+c;

if s

then writeln(s,'/',i)

else if s=i

then writeln(1)

else writeln(1,'+',s-i,'/',i)

end.

var

n,m,i,a,j,t:longint;

f:boolean;

begin

for i:=n to m do begin

a:=i;f:=true;

repeat

for j:=2to trunc(sqrt(a))do

if a mod j=0then f:=false;

a:=a div10;

until(a=0)or(f=false);

if f then inc(t);

end;

writeln(t);

end.

7

32

4.四个整数,在相邻两数之间任意添上"+"或"-"可以构成不同的式子,并得到不同的值,例如6,-3,10,2可以有以下8个不同的式子:6+(-3)+10+2=156+(-3)+10-2=11 6+(-3)-10+2=-56-(-3)+10+2=216+(-3)-102-2=-96-(-3)+10-2=17 6-(-3)-10+2=16-(-3)-10-2=-3

6-(-3)+10+2=21

6+(-3)-102-2=-9

6-(-3)-10-2=-3

var k,a,b,c,d,x,y,z,s,t:integer;

begin

for x:=1to2do

for y:=1to2do

for z:=1to2do begin

s:=a;

if x=1then s:=s+b else s:=s-b;

if y=1then s:=s+c else s:=s-c;

if z=1then s:=s+d else s:=s-d;

if s mod k=0then begin

write(a);

if x=1then write('+')else write('-');

if b>0then write(b)else write('(',b,')');

if y=1then write('+')else write('-');

if c>0then write(c)else write('(',c,')');

if z=1then write('+')else write('-');

if d>0then write(d)else write('(',d,')');

writeln('=',s);t:=t+1;

end;

end;

if t=0then writeln(’Impossible’);

end.

6-10-(-3)-4=-5

50+36-（-32）+（-30）=88

50-36+（-32）+（-30）=-48

50-36-（-32）+（-30）=16