var

a,b,c,d,f:integer;

e:array[1..10000]of integer;

begin

read(a);

for b:=1 to a do read(e);

f:=a;

for d:=1 to a-1 do

for b:=d to a-1 do begin

if e>e then begin c:=e; e:=e; e:=c; end; end;

for d:=1 to a do

for b:=1 to a do if e=e then begin e:=0; f:=f-1; end;

writeln(f);

for b:=1 to f do

write(e,' ');

end.

2 条评论

  • @ 2016-07-13 10:08:05

    #include<cstdio>
    #include<cstdlib>
    #include <iostream>
    using namespace std;
    int a[1001];
    int main ()
    {

    int n,f=0,s;
    cin>>n;
    for (int i=0;i<n;i++)
    {
    cin>>s;
    if (a[s]==0)
    {
    a[s]=1;f++;
    };
    };
    cout<<f<<"\n";
    for (int i=0;i<1001;i++)
    if(a[i]) cout<<i<<' ';

    return 0;
    }

  • @ 2015-11-01 11:21:06

    嘿,你在干嘛?计数不就行了。
    program lkdsjflkjds;
    var i,j,m,n,t:integer;a:array[1..1000]of integer;
    begin
    readln(n);
    for i:=1 to n do
    begin
    read(j);
    a[j]:=1;
    end;
    for i:=1 to 1000 do m:=m+a[i];
    writeln(m);
    for i:=1 to 1000 do if a[i]=1 then write(i,' ');
    end.

  • 1

信息

ID
1316
难度
3
分类
其他 | 排序 点击显示
标签
递交数
9961
已通过
4874
通过率
49%
被复制
33
上传者