level 6
Type num=set of longint;
var
a:array[1..100] of longint;
n,i,y:longint;
x,s:num;
begin
readln(n);
x:=[1..1000];
s:=[1..1000];
for i:=1 to n do
begin
readln(a[i]);
if a[i] in x then
x:=x-a[i];
end;
s:=s-x;
for i:=1 to 1000 do
if i in s then y:=y+1;
writeln(y);
for i:=1 to 1000 do
if i in s then write(i,' ');
end.
2014年04月19日 10点04分
1
level 6
这是题目:
明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。
2014年04月19日 10点04分
2
level 6
2014-04-19_18.43.37.441373.5031.pas(1,24) Error: illegal type declaration of set elements
2014-04-19_18.43.37.441373.5031.pas(5,8) Error: Illegal expression
2014-04-19_18.43.37.441373.5031.pas(8,10) Error: range check error while evaluating constants
2014-04-19_18.43.37.441373.5031.pas(9,10) Error: range check error while evaluating constants
2014-04-19_18.43.37.441373.5031.pas(13,13) Error: Set type expected
2014-04-19_18.43.37.441373.5031.pas(18,10) Error: Set type expected
2014-04-19_18.43.37.441373.5031.pas(18,23) Warning: Variable 'y' does not seem to be initialized
2014-04-19_18.43.37.441373.5031.pas(21,8) Error: Set type expected
2014-04-19_18.43.37.441373.5031.pas(23) Fatal: There were 7 errors compiling module, stopping
2014年04月19日 11点04分
3
level 13
var n,m,i,a:longint;
b:array[1..1000] of boolean;
begin
fillchar(b,sizeof(b),false);
readln(n);
m:=0;
for i:=1 to n do
begin
read(a);
b[a]:=true;
end;
readln;
for i:=1 to 1000 do if b[i] then m:=m+1;
writeln(m);
for i:=1 to 1000 do if b[i] then write(i,' ');
writeln;
end.
2014年04月19日 11点04分
5