请各位解答此题
我的代码:
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int N,M;
string students_num;
int main(){
cin>>N>>M;
for(int i=0;i<=N-1;i++){
cin>>students_num[i];
}
int numbers[1100];
for(int i=0;i<=N-1;i++){
numbers[i]=i;
}
string finding;
for(int i=0;i<=M-1;i++){
finding[i]=students_num.find(i);
}
for(int i=0;i<=M-1;i++){
if(finding[i]=='-1'){
bool mes=false;
mes=true;
break;
}
else{
goto all_student_num_correct;
}
}
all_student_num_correct:
cout<<M;
return 0;
int mes=true;
string student_not_num;
if(mes==true){
for(int i=0;i<=M-1;i++){
student_not_num[i]=finding.find('-1');
}
}
int student_not_num_int=stoi(student_not_num);
int not_num_out[1100];
for(int i=0;i<=M-1;i++){
students_num[student_not_num_int[i]]=not_num_out[i];
}
string int_to_string;
for(int i=0;i<=M-1;i++){
int_to_string[i]=to_string(not_num_out[i]);
}
for(int i=0;i<int_to_string[i];i++){
cout<<not_num_out[i]<<" ";
}
return 0;
}