看神是怎样AC的

测试数据 #0: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 828 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 828 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 832 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 832 KiB, score = 10
Accepted, time = 0 ms, mem = 832 KiB, score = 100

代码如下:

program Project1;

var
a, b: array[1..1000] of longint;
n, i, j, t: longint;
begin
readln(n);
for i := 1 to n do
Read(a[i]);
readln;
for i := 1 to n - 1 do
for j := 1 to n - i do
if a[j] > a[j + 1] then
begin
t := a[j];
a[j] := a[j + 1];
a[j + 1] := t;
end;
for i := 1 to n - 1 do
if a[i] = a[i + 1] then
a[i] := maxlongint;
t := 0;
for i := 1 to n do
if a[i] <> maxlongint then
t := t + 1;
writeln(t);
j := 1;
for i := 1 to n do
if a[i] <> maxlongint then
begin
b[j] := a[i];
Inc(j);
end;
for i := 1 to j - 2 do
Write(b[i], ' ');
writeln(b[j - 1]);
end.

10 条评论

  • @ 2016-03-08 16:50:43
    // input code here
    
  • @ 2014-08-08 19:46:13

    评测状态 Wrong Answer
    题目 P1316 明明的随机数
    递交时间 2014-08-08 19:40:29
    代码语言 Pascal
    评测机 VijosEx
    消耗时间 30 ms
    消耗内存 612 KiB
    评测时间 2014-08-08 19:40:30
    评测结果
    编译成功

    Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
    Copyright (c) 1993-2012 by Florian Klaempfl and others
    Target OS: Win32 for i386
    Compiling foo.pas
    foo.pas(3,11) Note: Local variable "b" not used
    Linking foo.exe
    33 lines compiled, 0.3 sec , 28608 bytes code, 1628 bytes data
    1 note(s) issued
    测试数据 #0: Accepted, time = 0 ms, mem = 612 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 604 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 604 KiB, score = 10
    测试数据 #3: Accepted, time = 15 ms, mem = 608 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 608 KiB, score = 10
    测试数据 #5: Accepted, time = 0 ms, mem = 608 KiB, score = 10
    测试数据 #6: Accepted, time = 0 ms, mem = 608 KiB, score = 10
    测试数据 #7: Accepted, time = 0 ms, mem = 608 KiB, score = 10
    测试数据 #8: Accepted, time = 0 ms, mem = 608 KiB, score = 10
    测试数据 #9: WrongAnswer, time = 15 ms, mem = 612 KiB, score = 0
    WrongAnswer, time = 30 ms, mem = 612 KiB, score = 90
    代码
    var
    n,m,i,j,k,t:longint;
    a,b:array[1..100] of integer;
    begin
    readln(n);
    m:=n;
    for i:=1 to n do
    read(a[i]);
    begin
    for i:=1 to n-1 do
    for j:=i+1 to n do
    begin
    if a[i]=a[j] then begin
    for k:=j to m do
    begin
    a[k]:=a[k+1];
    end;
    n:=n-1;
    end;
    end;
    end;
    begin
    for i:=1 to n-1 do
    for j:=i+1 to n do
    begin
    if a[i]>a[j] then begin
    t:=a[i];a[i]:=a[j];a[j]:=t;
    end;
    end;
    writeln(n);
    for k:=1 to n do
    write(a[k],' ');
    end;
    end.

  • @ 2014-07-21 21:15:33

    你们学没学过c++? 用set去重+排序

  • @ 2014-05-03 18:41:10

    看不懂

  • @ 2014-02-24 16:13:10

    #include<iostream>
    #include<algorithm>
    using namespace std;
    int a[101],b[101],m,n;
    int main()
    {
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n;i++)
    if(a[i]!=a[i-1]) {m++;b[m]=a[i];}
    cout<<m<<endl;
    for(int i=1;i<=m;i++)
    cout<<b[i]<<" ";
    return 0;

    }
    这才叫神 比你短多了

  • @ 2013-11-15 17:48:30

    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-27 21:55:33

    用**动规**.........

  • @ 2013-10-27 18:50:52

    呃呃呃

  • @ 2013-10-27 17:41:56

  • @ 2013-10-27 16:34:47

    希望以后题解能发到各题目的题解区下,谢谢合作!
    I wish that the problem solutions can be sent to each topic area under the problem solution, thank you!
    Решение Надежда проблема может быть отправлен в каждой тематической области под решение проблемы, спасибо!
    希望以後題解能發到各題目的題解區下,謝謝合作!
    ホープ問題解決、問題の解決策の下で、各トピックエリアに送信することができ、ありがとうございました!
    La solution du problème de l'espoir peut être envoyé à chaque sujet dans la solution du problème, merci!
    Rozwiązanie problemu Nadzieja mogą być wysyłane do każdego obszaru tematu w ramach rozwiązania problemu, dziękuję!

    • @ 2014-05-02 00:08:02

      瞬间感受到中文的优越性哈!

  • 1

信息

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