Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:eclipse juno 上手动测试 数据正常 运行无误 但是提交后REIn Reply To:eclipse juno 上手动测试 数据正常 运行无误 但是提交后RE Posted by:xxw90 at 2013-04-30 23:03:13 import java.io.BufferedInputStream; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String agrs[]){ Scanner sin1 = new Scanner(new BufferedInputStream(System.in)); Scanner sin2 = new Scanner(new BufferedInputStream(System.in)); // sin1.next() Finds and returns the next complete token from this char inchar[] = sin1.next().toCharArray(); char outchar[] = sin2.next().toCharArray(); // IMPORTANT // 提前关闭scanner 会造成异常 NoSuchElementException sin2中没有内容 // String output = sin2.next(); sin1.close(); sin2.close(); // A->65; Z->90 int inCount[] = new int[26]; int i, j; boolean flag = true; for (i = 0; i < inchar.length ; i++) { if(inchar[i]<=90 && inchar[i]>=65) inCount[inchar[i] - 'A']++; else flag = false; } int outCount[] = new int[26]; for (j = 0; j < outchar.length ; j++) { if(outchar[j]<=90 && outchar[j]>=65) outCount[outchar[j] - 'A']++; else flag = false; } Arrays.sort(inCount); Arrays.sort(outCount); if (Arrays.equals(inCount, outCount) && (inchar.length == outchar.length) && flag==true && inchar.length<=100) System.out.println("YES"); else System.out.println("NO"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator