Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73136 梁敖铭 处理随机数 C++ Compile Error 0 MS 0 KB 370 2024-05-18 09:36:22

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int n,tmp,ans=0 int cnt[1001]={}; cin>>n; while(n--){ cin>>tmp; cnt[tmp]++; if(cnt[tmp]==1){ ans++; } } cout<<ans<<endl; int i=1; while(cnt[i]==0)i++; cout<<i; for(i=i+1;i<1001;i++) if(cnt[i]>0){ cout<<" "<<i; cout<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:1: error: expected ',' or ';' before 'int'
 int cnt[1001]={};
 ^
Main.cc:10:5: error: 'cnt' was not declared in this scope
     cnt[tmp]++;
     ^
Main.cc:17:7: error: 'cnt' was not declared in this scope
 while(cnt[i]==0)i++;
       ^
Main.cc:20:8: error: 'cnt' was not declared in this scope
     if(cnt[i]>0){
        ^
Main.cc:32:2: error: expected '}' at end of input
  } 
  ^