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:请大家帮忙看看2159得思路

Posted by C061200548322 at 2006-05-21 17:12:13 on Problem 2159
In Reply To:请大家帮忙看看2159得思路 Posted by:dancia at 2005-04-02 12:24:39
> 这道题我想得很简单,就是把message2按照加密方式加密一次得到message3,
> 然后将message1和message3都按字典序排列后比较。一样就yes,不然就no。这
> 样有什么问题啊?哪位老大给组测试数据,谢谢
> 
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> 
> char a[110],b[110];
> char book[27]={"BCDEFGHIJKLMNOPQRSTUVWXYZA"};
> int cmp(const void *a,const void  *b)
> {   char c=*((char*)a);
>     char d=*((char*)b);
>     return c-d;
> }
> 
> main()
> {
>   int i,j;
>   gets(a);
>   gets(b);
>   for(i=0;i<strlen(b);i++)
>     b[i]= book[b[i]-'A'];
>   qsort(a,strlen(a),sizeof(char),cmp);
>   qsort(b,strlen(b),sizeof(char),cmp);
>   (!strcmp(a,b))?printf("YES"):printf("NO");
>   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