Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Why PE? Please help!!!#include <stdio.h> char a[12]; int n; char r[6]; void sort() { char x,m; char i,j; for(i=0;i<n-1;i++) { m=i; for(j=i+1;j<n;j++) { if(a[j]<a[m]) { m=j; } } x=a[i]; a[i]=a[m]; a[m]=x; } } void dg(int step, int k) { int i; if(step>5) { printf("\n"); for(i=0;i<5;i++) { printf("%d ",r[i]); } printf("%d",r[i]); } else { for(i=k;i<n;i++) { r[step]=a[i]; dg(step+1,i+1); } } } int main() { int i; printf("\n"); scanf("%d", &n); while(n>0) { for(i=0;i<n;i++) { scanf("%d",&(a[i])); } sort(); dg(0,0); scanf("%d", &n); if(n) printf("\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator