看不懂`!~顶`!




#include <iostream>
#include <algorithm>
using namespace std;const int MAXN=10;
int array[MAXN]={0,0,0,2,5,0,0,4,3,0},n=10;
int cur[MAXN],cur_size;int main()
{
cur_size=0;
for(int i=0;i<n;i++){
if(array[i]){
cur[cur_size++]=i;
}
}
if(cur_size>2){
srand(time(0));
random_shuffle(cur,cur+cur_size);
}
for(int i=0;i<cur_size-2;i++){
array[cur[i]]=0;
}
for(int i=0;i<n;i++){
printf(\"%d \",array[i]);
}
printf(\"\n\");
scanf(\"%*s\");
}