#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int i = 0;
int a = 0;
vector<int>vec_int;
while (cin >> a)
{
if (i<20 && a<256)
{
vec_int.push_back(a);
i++;
}
else
{
break;
}
}
//使用排序算法
sort(vec_int.begin(), vec_int.end());
for (int i = 0; i<vec_int.size(); i++)
{
if (i == 0 && vec_int[i] != vec_int[i+1])
{
cout << vec_int[i] << endl;
}
else if (i == (vec_int.size() - 1) && vec_int[i] != vec_int[i - 1])
{
cout << vec_int[i] << endl;
}
else if (vec_int[i] != vec_int[i - 1] && vec_int[i] != vec_int[i + 1])
{
cout << vec_int[i] << endl;
}
}
}
最后
以上就是清脆季节最近收集整理的关于找出输入数字中只出现了一次的那个数并输出——小米OJ试题的全部内容,更多相关找出输入数字中只出现了一次内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复