371 条题解

  • 0
    @ 2009-11-19 19:46:20

    var j,k,l,m,n:longint;

    a,b:array[1..256]of longint;

    begin

    readln(m);

    for j:=1 to m do

    read(a[j]);

    for j:=1 to m-1 do

    for k:=j+1 to m do

    if a[j]=a[k] then a[k]:=0;

    n:=0;

    for j:=1 to m do

    if a[j]>0 then begin

    n:=n+1;

    a[n]:=a[j];

    end;

    if n>1 then for j:=1 to n-1 do

    for k:=j+1 to n do

    if a[j]>a[k] then begin

    l:=a[j];

    a[j]:=a[k];

    a[k]:=l;

    end;

    writeln(n);

    for j:=1 to n do

    write(a[j],' ');

    end.

  • 0
    @ 2009-11-14 22:40:09

    简短一点的~~~

    var i,j,k,n:integer;a,b:array[1..10000]of integer;

    begin

    readln(n);

    for i:=1 to n do read(a[i]);

    for i:=1 to n-1 do

    for j:=i to n do

    if a[i]>a[j] then begin k:=a[i];a[i]:=a[j];a[j]:=k;end;

    k:=0;

    for i:=1 to n do if a[i]a then

    begin inc(k);b[k]:=a[i];end;

    writeln(k);for i:=1 to k do write(b[i]);

    end.

  • 0
    @ 2009-11-10 09:09:34

    太水了……用腿敲地

    var

    n,m,a,num,i:longint;

    f:array[1..1000]of boolean;

    begin

    readln(n);

    m:=0;

    for i:=1 to n do

    begin

    read(a);

    if f[a]=false then

    begin

    f[a]:=true;

    inc(m);

    end;

    end;

    writeln(m);

    num:=0;

    for i:=1 to 1000 do

    if f[i] then

    begin

    if num=m then writeln(i)

    else write(i,' ');

    end;

    end.

  • 0
    @ 2009-11-09 11:33:59

    牛B的桶排,直接在VJ网页上写,直接AC。

  • 0
    @ 2009-11-08 20:54:15

    #include

    using namespace std;

    int main()

    {

    int n,i,m,j;

    cin>>n;

    m=n;

    int a[i];

    for (i=0;i>a[i];

    }

    for (i=0;i

  • 0
    @ 2009-11-08 10:33:10

    var

    s,i,n:longint;a:array[1..100] of longint;

    procedure qsort(s,t:longint);

    var

    i,j,m,temp:longint;

    begin

    i:=s;j:=t;

    m:=a[(i+j) div 2];

    repeat

    while a[i]m do dec(j);

    if ij;

    if s

  • 0
    @ 2009-11-06 18:52:50

    var

    n,i,j,x:integer;

    a:array[1..1000]of integer;

    begin

    assign(input,'random.in');

    assign(output,'random.out');

    reset(input);

    rewrite(output);

    readln(n);

    for i:=1 to n do

    read(a[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]>a[j] then begin

    x:=a[i];

    a[i]:=a[j];

    a[j]:=x;

    end;

    x:=0;

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]=a[j] then a[j]:=0;

    for i:=1 to n do

    if a[i]>0 then x:=x+1;

    writeln(x);

    for i:=1 to n do

    if a[i]>0 then write(a[i],' ');

    close(input);

    close(output);

    end.

  • 0
    @ 2009-11-04 12:44:28

    水中冒泡。。。

  • 0
    @ 2009-11-01 18:28:31

    So easy:

    program suiji;

    var

    a:array[1..1000] of longint;

    i,j,k:longint;

    begin

    fillchar(a,sizeof(a),0);

    readln(k);

    for i:=1 to k do begin

    read(j);a[j]:=1;

    end;

    j:=0;

    for i:=1 to 1000 do if a[i]=1 then inc(j);

    writeln(j);

    for i:=1 to 1000 do if a[i]=1 then write(i,' ');

    end.

  • 0
    @ 2009-11-01 15:52:42

    士大夫士大夫

    for j:=i+1 to n do

    if a[i]>a[j] then

    begin

    x:=a[i];

    a[i]:=a[j];

    a[j]:=x;

    end;

    for i:=1 to n do

    if a[i]=a then begin a[i]:=-1; m:=m+1;

    士大夫士大夫

  • 0
    @ 2009-10-29 19:18:31

    program random;

    var

    n,i,j,x:integer;

    a:array[1..1000]of integer;

    begin

    assign(input,'random.in');

    assign(output,'random.out');

    reset(input);

    rewrite(output);

    readln(n);

    for i:=1 to n do

    read(a[i]);

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]>a[j] then begin

    x:=a[i];

    a[i]:=a[j];

    a[j]:=x;

    end;

    x:=0;

    for i:=1 to n-1 do

    for j:=i+1 to n do

    if a[i]=a[j] then a[j]:=0;

    for i:=1 to n do

    if a[i]>0 then x:=x+1;

    writeln(x);

    for i:=1 to n do

    if a[i]>0 then write(a[i],' ');

    close(input);

    close(output);

    end.

  • 0
    @ 2009-10-28 23:47:05

    可能我做的有点大材小用,用快速排序来排[1..100]的小数组。。。

    program random;

    var

    a,b:array[1..100] of integer;

    n,i,j,k,l,x,y:integer;

    procedure sort(k1,k2:integer);{快排过程}

    procedure swap(var a,b:integer);

    var

    t:integer;

    begin

    t:=a;

    a:=b;

    b:=t;

    end;{procedure_swap}

    var

    j,k,x,y:integer;

    begin

    j:=k1;k:=k2;

    x:=a[(k1+k2) div 2];

    repeat

    {repeat start}

    while a[j]

  • 0
    @ 2009-10-28 19:26:53

    var

    x:array[1..1000] of integer;

    n,i,t,ans:longint;

    begin

    readln(n); ans:=0;

    fillchar(x,sizeof(x),0);

    for i:=1 to n do

    begin

    read(t);if x[t]=0 then inc(ans);

    inc(x[t]);

    end;

    writeln(ans);

    for i:=1 to 1000 do

    if x[i]0 then write(i,' ');

    end.

    我的也是全对!标答!

  • 0
    @ 2009-10-26 18:25:07

    program mmdsjs;

    var

    a:array[1..1000]of 0..1;

    i,b:1..1000;

    n:0..100;

    begin

    readln(n);

    for i:=1 to n do

    begin

    read(b);

    a:=1;

    end;

    n:=0;

    for i:=1 to 1000 do

    if a[i]=1 then

    begin

    inc(n);

    end;

    writeln(n);

    for i:=1 to 1000 do

    if a[i]=1 then write(i,' ');

    writeln;

    end.

    5555555555555555555555555555555

    太大意了,居然提交了三次.

  • 0
    @ 2009-10-25 12:59:04

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    #include

    using namespace std;

    int main()

    {

    int a[1001],i,n,z,j=0;

    memset (a,0,sizeof(a));

    cin>>n;

    for (i=1;i>z;

    if(a[z]==0){j++;a[z]=1;}

    }

    cout

  • 0
    @ 2009-10-28 16:17:59

    program random;

    var a:array[1..1000] of integer;

    i,j:longint;

    b,n:integer;

    begin

    for i:=1 to 1000 do

    a[i]:=0;

    begin

    readln(n);

    for i:=1 to n do

    begin

    read(b);

    a:=a+1;

    end;

    for i:=1 to 1000 do

    if a[i]>=1 then inc(j);

    writeln(j);

    for i:=1 to 1000 do

    if a[i]>=1 then write(i,' ');

    end;

    end.

    一次AC,耶!

  • 0
    @ 2009-10-23 16:45:22

    jiayu888

    桶排序会更快的

  • 0
    @ 2009-10-21 23:13:59

    水题人更水……

    var

    a:array[1..100]of integer;

    b:array[1..10000]of boolean;

    l,h,i,j,n,num:integer;

    procedure qsort(l,h:integer);

    var i,j,x,te:integer;

    begin

    i:=l;

    j:=h;

    x:=a[(i+j) div 2];

    repeat

    while a[i]x do dec(j);

    if ij;

    if il then qsort(l,j);

    end;

    begin

    num:=0;

    fillchar(b,sizeof(b),true);

    readln(n);

    for i:=1 to n do

    begin

    read(j);

    if b[j] then begin

    b[j]:=false;

    inc(num);

    a[num]:=j;

    end;

    end;

    qsort(1,num);

    writeln(num);

    for i:=1 to num do

    write(a[i],' ');

    end.

  • 0
    @ 2009-10-09 21:48:49

    这么水的桶排序,由于没看清题目......竟然WA了三次

  • 0
    @ 2009-10-06 13:08:29

    var n,i,j,k:longint;

    b:array[0..2000]of boolean;

    begin

    readln(n);

    for i:=1 to n do begin

    read(j);

    if(b[j]=false) then inc(k);

    b[j]:=true;

    end;

    writeln(k);

    for i:=0 to 1002 do

    if(b[i]) then write(i,' ');

    end.

信息

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