- 明明的随机数
- 2009-02-15 11:14:17 @
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案错误...程序输出比正确答案长
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:90 有效耗时:0ms
program ex1316;
var n:array[1..100]of integer;
i,j,k,a,b:integer;
begin
readln(a);
for i:=1 to a do
read(n[i]);
for i:=1 to a do
if n[i]>1000 then begin
n[i]:=n;
a:=a-1;
end;
for i:=1 to a do
for j:=i+1 to a do
if n[i]=n[j] then begin
for k:=j to a do
n[k]:=n[k+1];
a:=a-1;
end;
writeln(a);
for i:=1 to a do
for j:=i+1 to a do
if n[i]>n[j] then begin
b:=n[i];
n[i]:=n[j];
n[j]:=b;
end;
for i:=1 to a do
write(n[i],' ');
end.
2 条评论
-
圣帕得里克 LV 7 @ 2016-09-30 08:20:35
No Why
-
2014-07-25 20:30:37@
var
a:array[1..100] of longint;
i,j,n,h,ns:longint;
begin
readln (n);
for i:=1 to n do read (a[i]);
readln;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if a[i]>a[j] then
begin
h:=a[i];
a[i]:=a[j];
a[j]:=h;
end;
end;
ns:=n;
for i:=2 to n do
if a[i]=a[i-1] then begin a[i-1]:=-1; dec(ns); end;
writeln (ns);
for i:=1 to n do
if a[i]<>-1 then write (a[i],' ');
readln;
end.
- 1