前言:都是暴力+模拟。
P1046 陶陶摘苹果 代码:
var
a:array [1..11] of longint;
n,s,i:longint;
begin
for i:=1 to 10 do
read(a[i]);
read(n);
n:=n+30;
for i:=1 to 10 do
if n>=a[i] then inc(s);
write(s);
end.
P1047 校门外的树
var
a:array[0..10000] of boolean;
l,m,i,s,e,j,c:integer;
begin
fillchar(a,sizeof(a),false);
c:=0;
readln(l,m);
for i:=1 to m do
begin
readln(s,e);
for j:=s to e do a[j]:=true;
end;
for i:=0 to l do if a[i]=false then inc(c);
writeln(c);
end.
P1427 小鱼的数字游戏
var
n,i:longint;
a:array [0..101] of longint;
begin
n:=0;
while not eoln do
begin
inc(n);
read(a[n]);
end;
for i:=n downto 1 do
if a[i]<>0 then write(a[i],' ');
end.
P1428 小鱼比可爱
var
n,i,j:longint;
a,f:array [0..101] of longint;
begin
fillchar(f,sizeof(f),0);
readln(n);
for i:=1 to n do
read(a[i]);
for i:=2 to n do
for j:=1 to i-1 do
if a[i]>a[j] then inc(f[i]);
for i:=1 to n do
write(f[i],' ');
end.