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

Re:再借地方用一下。^_^

Posted by ass at 2003-12-04 10:20:09 on Problem 1028
In Reply To:Re:再借地方用一下。^_^ Posted by:ass at 2003-12-03 22:41:40
#include "math.h"
#include "stdio.h"
void main()
{
	char a[10];
	int n,i,j,c;
	scanf("%d\n",&n);
	for (i=0;i<n;i++)
	{
		a[i]=getchar();
	}
	for (i=0;i<n-1;i++)
	{
		c=i;
		for (j=i+1;j<n;j++)
		{
			if (a[j]<a[i]) c=j;
		}
		printf("%c",a[c]);
		a[c]=a[i];
	}
    printf("%c\n",a[n-1]);
}

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