- 明明的随机数
- 2013-04-14 19:56:11 @
测试数据 #0: Accepted, time = 15 ms, mem = 2680 KiB, score = 10
测试数据 #1: Accepted, time = 23 ms, mem = 2684 KiB, score = 10
测试数据 #2: Accepted, time = 7 ms, mem = 2684 KiB, score = 10
测试数据 #3: Accepted, time = 11 ms, mem = 2680 KiB, score = 10
测试数据 #4: Accepted, time = 23 ms, mem = 2684 KiB, score = 10
测试数据 #5: Accepted, time = 11 ms, mem = 2684 KiB, score = 10
测试数据 #6: Accepted, time = 23 ms, mem = 2684 KiB, score = 10
测试数据 #7: Accepted, time = 15 ms, mem = 2680 KiB, score = 10
测试数据 #8: Accepted, time = 15 ms, mem = 2684 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 2684 KiB, score = 10
Summary: Accepted, time = 158 ms, mem = 2684 KiB, score = 100
const
max=1000000;
var a:array[1..max]of integer;
i,j,k,m,n:integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n-1 do
begin
for j:=i+1 to n do
if a[i]>=a[j] then
begin
k:=a[i]; a[i]:=a[j]; a[j]:=k;
end;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if a[i]=a[j] then
begin
a[i]:=0;
inc(m);
end;
end;
writeln(n-m);
for i:=1 to n do
if a[i]<>0 then
write(a[i],' ');
readln;
readln
end.
8 条评论
-
miaoyang LV 8 @ 2014-08-08 19:47:56
var n,m,i,ans:longint;
a:array[0..1005]of boolean;
begin
fillchar(a,sizeof(a),true);
readln(n);
for i:=1 to n do
begin read(m);a[m]:=false;end;
for i:=1 to 1000 do
if a[i]=false then inc(ans);
writeln(ans);
for i:=1 to 1000 do
if a[i]=false then write(i,' ');
end. -
2014-07-28 16:45:59@
15毫秒完美AC
-
2014-07-28 16:44:06@
测试数据 #0: Accepted, time = 0 ms, mem = 612 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 612 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 612 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 616 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 612 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 608 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 612 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 616 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 616 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 612 KiB, score = 10
Accepted, time = 15 ms, mem = 616 KiB, score = 100
代码
var a:array[1..100] of integer;
b:array[1..1000] of integer;
s,i,n:integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
readln;
for i:=1 to n do b[a[i]]:=1;
s:=0;
for i:=1 to 1000 do if b[i]=1 then inc(s);
writeln(s);
for i:=1 to 1000 do if b[i]=1 then write(i,' ');
writeln;
end. -
2013-11-15 17:47:58@
var n,m,i,ans:longint;
a:array[0..1005]of boolean;
begin
fillchar(a,sizeof(a),true);
readln(n);
for i:=1 to n do
begin read(m);a[m]:=false;end;
for i:=1 to 1000 do
if a[i]=false then inc(ans);
writeln(ans);
for i:=1 to 1000 do
if a[i]=false then write(i,' ');
end. -
2013-10-26 19:48:14@
####真慢~~
-
2013-10-23 11:21:47@
AC!!!!
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int b[1000],num,a;
bool sort[10000];
scanf("%d",&num);
for(int i=0;i<num;i++){
scanf("%d",&a);
sort[a]=1;
}a=0;
for(int i=0;i<=1000;i++) if(sort[i]) b[a++]=i;
printf("%d\n",a);
for(int i=0;i<a;i++) printf("%d ",b[i]);
return 0;
} -
2013-08-27 14:23:32@
好厉害好厉害
-
2013-04-15 20:43:39@
发表代码请按
TAB
- 1