|
|
вернуться в форумWhy crash on test #3 Послано team5 2 ноя 2009 15:12 import java.util.HashSet; import java.util.Locale; import java.util.Scanner; import java.util.Set; public class m1718 { public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner sc=new Scanner(System.in); Set<String> maxS=new HashSet<String>(); Set<String> minS=new HashSet<String>(); int n=Integer.parseInt(sc.nextLine()); String[] name=new String[n+1]; String[] s=new String[n+1]; int[] d=new int[n+1]; for (int i = 0; i < n; i++) { name[i]=sc.next(); s[i]=sc.nextLine();s[i].trim(); if(s[i].charAt(1)=='A'){ d[i]=0; }else { String[] s1=s[i].split(" "); d[i]=Integer.parseInt(s1[2]); } } for (int i = 0; i <n; i++) { if(d[i]==0) maxS.add(name[i]); if(d[i]>=6)maxS.add(name[i]); if(d[i]==7)minS.add(name[i]); } System.out.println(minS.size()+" "+maxS.size()); } } Edited by author 02.11.2009 16:22 |
|
|