Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
82443 sh25_shenpy 字符数组的定义赋值与输出实验 C++ 解答错误 0 MS 256 KB 300 2026-01-13 17:49:11

Tests(0/1):


#include<bits/stdc++.h> using namespace std; int a[1001]; int main(){ int n,x,cnt=0; cin>>n; for(int i=1;i<=n;i++){ cin>>x; a[x]=x; } for(int i=1;i<1001;i++){ if(a[i]!=0) cnt++; } cout<<cnt<<endl; for(int i=1;i<1001;i++){ if(a[i]!=0) cout<<a[i]<<' '; } return 0; }


测评信息: