题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2761

直接暴力。

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int inline readint(){
int Num=,Flag=;char ch;
while((ch=getchar())<''||ch>'') if(ch=='-') break;
if(ch=='-') Flag=-; else Num=ch-'';
while((ch=getchar())>=''&&ch<='') Num=Num*+ch-'';
return Num*Flag;
}
struct DATA{
int num,idx;
bool tag;
}a[];
bool cmp1(const DATA &a,const DATA &b){
return a.num!=b.num?a.num<b.num:a.idx<b.idx;
}
bool cmp2(const DATA &a,const DATA &b){
return a.idx<b.idx;
}
int tmp[],cnt;
int main(){
int Test=readint();
while(Test--){
int N=readint();
for(int i=;i<=N;i++){
a[i].num=readint();
a[i].idx=i;
}
sort(a+,a++N,cmp1);
a[].tag=true;
for(int i=;i<=N;i++) a[i].tag=a[i-].num!=a[i].num;
sort(a+,a++N,cmp2);
cnt=;
for(int i=;i<=N;i++)
if(a[i].tag)
tmp[++cnt]=a[i].num;
for(int i=;i<cnt;i++) printf("%d ",tmp[i]);
printf("%d",tmp[cnt]);
if(Test>=) putchar('\n');
}
return ;
}

[BZOJ2761][JLOI2011]不重复数字 暴力的更多相关文章

  1. [BZOJ2761][JLOI2011]不重复数字

    [BZOJ2761][JLOI2011]不重复数字 试题描述 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复 ...

  2. [BZOJ2761] [JLOI2011] 不重复数字 (C++ STL - set)

    不重复数字 题目:         给出N个数,要求把其中重复的去掉,只保留第一次出现的数.例如,给出的数 为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 1 ...

  3. [BZOJ2761] [JLOI2011] 不重复数字 (set)

    Description 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 ...

  4. BZOJ2761:[JLOI2011]不重复数字(map)

    Description 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 ...

  5. BZOJ2761: [JLOI2011]不重复数字【set】【傻逼题】

    Description 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 ...

  6. bzoj2761: [JLOI2011]不重复数字(hash)

    题目大意:给出N个数,要求把其中重复的去掉,只保留第一次出现的数.例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 6 5 4. ...

  7. 【set】bzoj2761 [JLOI2011]不重复数字

    set去重. #include<cstdio> #include<set> using namespace std; set<int>S; ],b[],en; in ...

  8. BZOJ 2761: [JLOI2011]不重复数字 水题

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2100  Solved: 809 题目连接 http:// ...

  9. bzoj 2761 [JLOI2011]不重复数字(哈希表)

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 3210  Solved: 1186[Submit][Sta ...

随机推荐

  1. download file by python in google colab

    https://stackoverflow.com/questions/15352668/download-and-decompress-gzipped-file-in-memory You need ...

  2. 一步一步学Silverlight 2系列(12):数据与通信之WebClient

    概述 Silverlight 2 Beta 1版本发布了,无论从Runtime还是Tools都给我们带来了很多的惊喜,如支持框架语言Visual Basic, Visual C#, IronRuby, ...

  3. 深入浅出Oracle学习笔记:Buffer Cache 和Shared pool

    Buffer cache 和 share pool 是sga中最重要最复杂的部分. 一.Buffer Cache 通常数据的读取.修改都是通过buffer cache 来完成的.buffer cach ...

  4. linux静默安装Oracle 11g

    ./runInstaller -silent -force -responseFile /home/oracle/software/database/response/orcl_install.rsp ...

  5. 嵌入式Linux学习方法——给那些彷徨者(上)

    要想学好嵌入式Linux,首先要解决两个重要问题: 1. 学什么? 2. 怎么学? 首先解决第一个问题. 嵌入式Linux的系统架构包括软件和硬件两个部分,如下图: 再来看看一个成熟的嵌入式产品的开发 ...

  6. c# 常用的面试题

    2 .列举ASP.NET 页面之间传递值的几种方式. 答. 1).使用QueryString, 如....?id=1; response. Redirect()....                 ...

  7. python的time模块使用

    在平常的代码中,我们常常需要与时间打交道.在Python中,与时间处理有关的模块就包括:time,datetime以及calendar.这篇文章,主要讲解time模块. 在开始之前,首先要说明这几点: ...

  8. 使用Code First 迁移发布asp.net mvc 程序

    通过Code First 迁移发布asp.net mvc应用程序,与在visual studio 程序包控制器管理台中运行Add-Migration ,Update-Database 一致. 在发布的 ...

  9. 6-13 Hog特征1

    Hog特征与Haar特征有点不同,Hog特征是直接经过模板计算得到的

  10. 012--python字符编码和list列表和循环语句

    一.字符编码: ASCII码最多只能表示 256个符号,每一个字符占8位 为什么一个字节占8位?因为计算机在读一串二进制数111011001111101110的时候, 要按照规定的长度截取,才能分清一 ...