1.11 编程基础之二分查找 08 不重复地输出数 python
2022/1/12 17:06:32
本文主要是介绍1.11 编程基础之二分查找 08 不重复地输出数 python,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
http://noi.openjudge.cn/ch0111/08/
""" 1.11 编程基础之二分查找 08 不重复地输出数 http://noi.openjudge.cn/ch0111/08/ Python字符串去重 https://www.jianshu.com/p/b9162f389b5c https://www.cnblogs.com/zhenghiber/p/15110871.html Python:对输入的单词进行字典序排序输出 https://www.cnblogs.com/JodieRao/p/12635910.html Python 程序按字母顺序对单词进行排序 https://www.nhooo.com/python/python-examples-alphabetical-order.html """ n=int(input()) a=list(map(int,input().split())) a.sort() b=[] for word in a: if not word in b: b.append(word) for i in b: print(i,end=' ')
C++代码
/* 1245:不重复地输出数 http://ybt.ssoier.cn:8088/problem_show.php?pid=1245 1.11编程基础之二分查找_08不重复地输出数 http://noi.openjudge.cn/ch0111/08/ */ #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<string> #define INF 999999999 #define N 1000001 #define MOD 1000000007 #define E 1e-3 using namespace std; int a[N]; int main( void ) { int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); cout<<a[1]; for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) cout<<" "<<a[i]; cout<<endl; return 0; }
这篇关于1.11 编程基础之二分查找 08 不重复地输出数 python的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-27使用python 将ETH账户的资产打散
- 2024-09-26Python编程基础
- 2024-09-2610 种方法写出更好的 Python 代码
- 2024-09-25Python编程基础详解
- 2024-09-25Python编程入门教程
- 2024-09-25从零开始使用Python构建LLaMA 3
- 2024-09-23Python中理解和使用树形结构的简单教程
- 2024-09-23Python 编程基础入门
- 2024-09-18初探Python股票自动化交易:入门指南
- 2024-09-18Python量化入门:轻松掌握量化分析基础与实战