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:1002总是得到“Answer Wrong”,谁帮我看看哪里有问题?

Posted by guoz0003 at 2007-10-24 15:13:29
In Reply To:1002总是得到“Answer Wrong”,谁帮我看看哪里有问题? Posted by:guoz0003 at 2007-10-24 15:08:48
> 我用java写的,code在下面。
> 
> import java.util.Scanner;
> import java.util.Arrays;
> public class Main {
> 	public static void main(String[] args){
> 		Scanner sc = new Scanner(System.in);
> 		String[] str = new String[Integer.parseInt(sc.nextLine())];
> 		char ch;
> 		int j;
> 		String tem;
> 		for(int i=0; i<str.length; i++){
> 			str[i] = sc.nextLine();
> 			tem="";
> 			for(j=0; j<str[i].length(); j++){
> 				ch = str[i].charAt(j);
> 				switch(ch){
> 				case '0':
> 				case '1': 
> 				case '2':
> 				case '3':
> 				case '4':
> 				case '5':
> 				case '6':
> 				case '7':
> 				case '8':
> 				case '9': 
> 					tem+=ch;
> 					break;
> 				case 'A':
> 				case 'B':
> 				case 'C':
> 					tem+="2";
> 					break;
> 				case 'D':
> 				case 'E':
> 				case 'F':
> 					tem+="3";
> 					break;
> 				case 'G':
> 				case 'H':
> 				case 'I':
> 					tem+="4";
> 					break;
> 				case 'J':
> 				case 'K':
> 				case 'L':
> 					tem+="5";
> 					break;
> 				case 'M':
> 				case 'N':
> 				case 'O':
> 					tem+="6";
> 					break;
> 				case 'P':
> 				case 'R':
> 				case 'S':
> 					tem+="7";
> 					break;
> 				case 'T':
> 				case 'U':
> 				case 'V':
> 					tem+="8";
> 					break;
> 				case 'W':
> 				case 'X':
> 				case 'Y':
> 					tem+="9";
> 					break;
> 				default:
> 						
> 				}
> 			}
> 			str[i]=tem.substring(0, 3)+"-"+tem.substring(3);
> 		}
> 		Arrays.sort(str);
> 		tem=str[0];
> 		j=0;
> 		for(int i=0; i<str.length; i++){
> 			if(!tem.equals(str[i])){
> 				if(j!=1)
> 					System.out.println(tem+" "+j);
> 				j=0;
> 				tem=str[i];
> 			}
> 			j++;
> 		}
> 		if(j!=1)
> 			System.out.println(tem+" "+j);
> 	}
> }
我在自己电脑上运行的时候sample可以得到正确的答案啊。

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