Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
1 #include <stdio.h> 2 int main() 3 { 4 int n,seq[101],min,i,idx; 5 while (scanf("%d",&n),n) 6 { 7 min=0x3f3f3f3f; 8 for(i=0;i<n;i++) 9 { 10 scanf("%d",&seq[i]); 11 if(seq[i]<min) 12 { 13 min=seq[i]; 14 idx=i; 15 } 16 } 17 seq[idx]=seq[0]; 18 printf("%d",min); 19 for(i=1;i<n;i++) printf(" %d",seq[i]); 20 printf("\n"); 21 } 22 return 0; 23 }
本文转自ZH奶酪博客园博客,原文链接:http://www.cnblogs.com/CheeseZH/archive/2012/05/26/2518972.html,如需转载请自行联系原作者