题中好像时间卡的比较紧,我用codeblocks运行挺快的到这里就运行超时不行。
问题:
代码
#include
int main(void){
int what[11];
int n=0;
int i;
int h;
char c;
while(1){
scanf("%d%c",&what[n+1],&c);
n+=1;
if(c=='\n'){
break;
}
}
int temp;
for(i=1;ifor(h=1;h<=n-i;h++){
if(what[h]>what[h+1]){
temp = what[h];
what[h] = what[h+1];
what[h+1] = temp;
}
}
}
for(i=1;i<=n;i++){
printf("%d ",what[i]);
}
return 0;
}
改进算法吧