题解 | #明明的随机数#

明明的随机数

https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0

#include <stdio.h>
#include <string.h>
int main() {
/*
*This is a solution by using C language implement.
*@Author ChrisJohnson 
*@Email:chrisjohnsoncode@outlook.com
*@Algorithm description(by using nature language-English)
*Store the entered number into the array index, and the corresponding value is 1, indicating that *data is stored at this location.
*/
    int number;
    int index;
    int data[1500]={0};
    scanf("%d",&number);
    for(int i=0;i<number;i++){
        scanf("%d",&index);
        data[index]=1;
    }
    for(int i=0;i<1500;i++){
        if(data[i]==1) printf("%d\n",i);
    }
    return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
2025-12-31 03:40
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务