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;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值