Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Sorry this is the lastest one

Posted by milesliu at 2009-08-25 13:49:02 on Problem 2245
In Reply To:Why PE? Please help!!! Posted by:milesliu at 2009-08-25 13:47:05
> #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;
>     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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator