通过遍历查重,直接赋0 摘要:解题思路:注意事项:用一个新的数组存更好。参考代码:#include<iostream>#include<algorithm>using namespace std;int main(){int a…… 题解列表 2021年03月09日 0 点赞 0 评论 224 浏览 评分:9.9
1102: 明明的随机数 摘要:```cpp #include #include using namespace std; int main() { int N,i,j=0,b[100]; cin>>N…… 题解列表 2022年09月04日 0 点赞 0 评论 196 浏览 评分:9.9
明明的随机数(真的是随机数,求大佬指出错误!) 摘要:解题思路:注意事项:参考代码:#include <iostream>#include<ctime>#include<cstdlib>using namespace std;int main(){ i…… 题解列表 2023年06月21日 0 点赞 0 评论 99 浏览 评分:9.9
一个运用基础知识能解的题 摘要:解题思路: 利用多次for循环输入到一个一维数组a[105](因为是N <=100,所以a[105]够了)里, 然后再利用for把重复的都标记 题解列表 2022年02月18日 0 点赞 0 评论 136 浏览 评分:9.9
1102: 明明的随机数(基础,思路简洁,有意思) 摘要:解题思路:注意事项:参考代码:#include<iostream>#include<algorithm>//用于sort函数using namespace std;int main(){ int…… 题解列表 2024年03月11日 0 点赞 0 评论 133 浏览 评分:9.9
明明的随机数 题解 摘要:解题思路:这题题目要求给出n个数,把全部数输入,进行“去重”并“排序”的操作,最后输出操作完后的数列。那么这题我用了set轻松水过......STL中的set(也称集合),在输入时会自动排序并会去掉重…… 题解列表 2022年04月28日 0 点赞 6 评论 118 浏览 评分:9.9
1102: 明明的随机数 摘要:解题思路:去重:数组的去重是很难直接把重复值“删去”的,此题要求输入的随机数都是正整数,所以可以把重复值全改成0,最后输出非0数,就算去重了。先排序,后去重。排序使用快速排序。注意事项:快速排序函数中…… 题解列表 2022年05月20日 0 点赞 0 评论 189 浏览 评分:9.9
明明的随机数sort() + unique()两个函数使用 摘要: ### 算法 (排序去重) $$O(nlogn)$$ 考察两个函数的使用: - sort:可以将序列排序 - unique:可以将序列中所有相邻的重复元素删除(只保留一个)。此处的删除,并…… 题解列表 2021年09月03日 0 点赞 0 评论 366 浏览 评分:9.9
明明的随机数 摘要:```cpp include include include include using namespace std; const int N = 110; int n; in…… 题解列表 2024年11月03日 1 点赞 0 评论 167 浏览 评分:9.9
明明的随机数(正规) 摘要:解题思路:把相等于0,然后在排,在定义个数组,把不等于0的复制其中,然后输出.......注意事项:无参考代码:#include<iostream>#include<algorithm>using n…… 题解列表 2023年06月28日 0 点赞 0 评论 116 浏览 评分:9.9