Python教程

1.9 编程基础之二分查找 13:整数去重 python

本文主要是介绍1.9 编程基础之二分查找 13:整数去重 python,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

http://noi.openjudge.cn/ch0109/13/

"""

1.9 编程基础之二分查找 13:整数去重
http://noi.openjudge.cn/ch0109/13/

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


Python常用的几种去重方式
https://blog.csdn.net/qq_40304090/article/details/82020576


python实现整数去重并排序
https://blog.csdn.net/weixin_45912307/article/details/108661232

"""
 
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++代码:

/*
1.9编程基础之顺序查找_13整数去重
http://noi.openjudge.cn/ch0109/13/
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
	int n,a,h[20010]={0};
	
	cin>>n;

	for (int i=1;i<=n;i++)
	{
		cin>>a;
		if (h[a]==0) 
		{
			cout<<a<<" ";
		} 
		h[a]++; 
	}
	
	return 0;
}

这篇关于1.9 编程基础之二分查找 13:整数去重 python的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!