bzoj 2761: [JLOI2011]不重复数字
来源:互联网 发布:怎样在淘宝里开网店 编辑:程序博客网 时间:2024/05/29 09:40
→题目链接←
新博客连接:https://www.everlasting.wang/archives/208
【想说的话】
水水水水水水水水水水水水水水水
水水水水水水水水水水水水水水水水水
水水水水水水水水水水水水水水水
水水水水水水水水水水水水水水水水水水水水
【题解】
直接用map保存某个数是否出现过
注意:不能一边扫一边输出,末尾有空格会PE
【代码】
#include<bits/stdc++.h>using namespace std;inline int rd(){int x=0,y=1;char c=getchar();while(c<'0' || c>'9'){if(c=='-')y=-y;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*y;}int T,n;map<int,bool>mp;vector<int>ans;void work(){mp.clear();ans.clear();n=rd();for(int i=0; i<n; i++){int x=rd();if(!mp[x]){mp[x]=1;ans.push_back(x);}}printf("%d",ans[0]);for(int i=1; i<ans.size(); i++)printf(" %d",ans[i]);puts("");}int main(){T=rd();while(T--){work();}return 0;}
阅读全文
0 0
- bzoj 2761: [JLOI2011]不重复数字
- bzoj 2761: [JLOI2011]不重复数字 排序
- 【BZOJ 2761】[JLOI2011]不重复数字
- BZOJ 2761: [JLOI2011]不重复数字
- BZoj 2761: [JLOI2011]不重复数字 (set
- bzoj 2761 [JLOI2011]不重复数字
- [bzoj-2761][JLOI2011]不重复数字 题解
- BZOJ[2761][JLOI2011]不重复数字 STL
- bzoj 2761: [JLOI2011]不重复数字
- BZOJ [JLOI2011]不重复数字
- BZOJ 大视野 2761: [JLOI2011]不重复数字 解题报告
- BZOJ 2761: [JLOI2011]不重复数字(傻逼题)
- 2761: [JLOI2011]不重复数字
- 2761: [JLOI2011]不重复数字
- 【JLOI2011】不重复数字
- 【bzoj2761】[JLOI2011]不重复数字
- bzoj2761 [JLOI2011]不重复数字
- [BZOJ2761][JLOI2011]不重复数字
- 【MFC】MFC工程创建控制台打印Log消息
- CTEX安装教程与注意事项
- Response
- 使用virtual box遇到的问题
- hibernate多对多的配法(xml文件)
- bzoj 2761: [JLOI2011]不重复数字
- Android 仿京东【购物车】包含MVP.网络拦截器.防内存泄露...
- 3. x86 寄存器
- Spring 注解----- 开启Annotation <context:annotation-config> 和 <context:component-scan>诠释及区别
- c++中继承与组合
- 一款适合练手的壁纸应用
- 高级Java程序员要具备哪些知识
- maven多模块项目
- struts2升级到Struts 2.3.15.1的步骤