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

一次就过了。不难,贴个代码参考一下:

Posted by 0810311106 at 2009-09-03 10:58:56 on Problem 1617
#include"stdio.h"
#include"string.h"
int getmin(char a[])
{
     int i,j=0;
     char c='z';/*将c的值置最大(小写z就行了)*/
     for(i=0;i<strlen(a);i++)
      if(c>a[i])
        {
            c=a[i];
             j=i;
        }
        a[j]='z';/*去掉这个最小值,便于下次取次最小值*/
       return j;
}
int main()
{
     char keyword[50];
     while(scanf("%s",&keyword)&&strcmp(keyword,"THEEND"))
         {
                char a[101],b[101];
                int i,j,k,m=0,n;
                scanf("%s",&a);
                /*获取结果*/
                for(i=0;i<strlen(keyword);i++)
                    {
                          j=getmin(keyword);
                           n=j;
                          for(k=0;k<strlen(a)/strlen(keyword);k++)
                           {
                                b[n]=a[m];
                                m++;
                                n+=strlen(keyword);
                           }
                    }
           for(i=0;i<strlen(a);i++)//输出
           printf("%c",b[i]);
           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