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

Posted by wskiwwwx at 2010-08-01 12:51:14 on Problem 3349
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		boolean flag = true;
		for (int i = 0; i < n; ++i) {
			int[] snow = new int[6];
			for (int j = 0; j < 6; ++j) {
				snow[j] = sc.nextInt();
			}
			Arrays.sort(snow);
			StringBuilder s = new StringBuilder();
			for (int j = 0; j < 6; ++j) {
				s.append(snow[j]);
			}
			int hashCode = s.toString().hashCode();
			//System.out.println("hashCode:"+hashCode);
			if (list.contains(hashCode)) {
				flag = false;
				break;
			} else
				list.add(hashCode);
		}
		if (flag)
			System.out.println("No two snowflakes are alike.");
		else
			System.out.println("Twin snowflakes found.");
	}

}

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