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

大牛们帮忙看看,一直WA,谢谢!

Posted by loveKid at 2008-12-14 16:03:18 on Problem 2159
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String encrypting=scanner.next();
        String original=scanner.next();
        String temp="";char[] tem;
        int length=original.length();
        char[]ori=original.toCharArray();
        char[]enc=encrypting.toCharArray();
         for(int i=0;i<length;i++)
        {if(ori[i]!='Z'){ori[i]=++ori[i];temp+=ori[i];}
        else temp+='A';}
       tem=temp.toCharArray();
       java.util.Arrays.sort(tem);
       java.util.Arrays.sort(enc);
       int work=1;
    for(int h=0;h<length;h++)if(tem[h]!=enc[h]){work=0;break;}
    
  if(work==1)System.out.println("YES");else System.out.println("NO");
      }
}

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