无数据结构纯语句操作剔除数组元素 解题思路:在删除相同元素的操作中,使用数据结构知识会比较简便。但是对于C语言小白来说还不太会指针等后面的知识和操作。于是我们采用笨方法纯语句操作:逐个比较数组元素,相同者赋0,最后排序之后把前面的0项全部截断输出即可!注意事项:参考代码:#define_CRT_SECURE_NO_WARNINGS1# 题解列表 2026年07月22日 0 点赞 0 评论 59 浏览 评分:0.0
去重,然后用插入排序 摘要:#include<stdio.h> #include<string.h> #include<malloc.h> int main(){ int n; int state = sc…… 题解列表 2022年01月23日 0 点赞 0 评论 601 浏览 评分:0.0
1165: 明明的随机数 摘要:解题思路:注意事项:参考代码:n = int(input()) l=set(map(int,input().split())) l=list(l) l.sort() print(len(l))…… 题解列表 2022年02月03日 0 点赞 0 评论 485 浏览 评分:0.0
Hifipsysta-1165-明明的随机数(C++代码)基于STL的实现,我敢说这是本题最简单的代码 摘要: ```cpp #include #include using namespace std; int main(){ int n,tmp; scanf("%d", &…… 题解列表 2022年02月07日 0 点赞 0 评论 541 浏览 评分:0.0
【明明的随机数】 (C语言代码) 摘要:解题思路:排序直接调用stdlib.h里的qsort函数,排序之后把数组从后往前查重,遇到重复的就置-1(随机数不会为负)注意事项:参考代码:#include <stdio.h>#include<st…… 题解列表 2018年04月16日 1 点赞 1 评论 594 浏览 评分:0.0
【明明的随机数】 (C语言代码)只用一个数组实现 摘要:#include <stdio.h> #include <stdlib.h> int main(void) { int M, i, j, temp; int *A; …… 题解列表 2018年06月23日 0 点赞 0 评论 1809 浏览 评分:0.0
【明明的随机数】 (C++代码) 摘要://用STL的sort()排序,unique()去重即可 #include <iostream> #include <cstdlib> #include <cmath> #include <d…… 题解列表 2018年02月11日 0 点赞 0 评论 1953 浏览 评分:0.0
【明明的随机数】 (C语言代码) 摘要:解题思路:注意事项:自定义一个排序函数,输出函数,去重函数,我写的输出函数与去重函数合为一个,注意数组的传递参考代码:#include<stdio.h>void prin(int arre[],int…… 题解列表 2017年12月10日 0 点赞 0 评论 1575 浏览 评分:0.0
#C++1165——明明的随机数(set容器) ```cpp#include#include#include#includeusingnamespacestd;intmain(){intm;cin>>m;int*arr=newint[m];setbrr;//set容器,自动排序,去重//srand(time(NULL));//产生随机数种子for( 题解列表 2022年07月14日 0 点赞 0 评论 688 浏览 评分:0.0
【明明的随机数】 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int x,a[100],i,j,k,t; scanf("%d",&x); for(i=0;i<x;i++) {…… 题解列表 2017年12月10日 0 点赞 0 评论 1422 浏览 评分:0.0