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 |
为什么REimport 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator