왜 안되나요
조회수 450회
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[]args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); int stack=0; int year[] = new int[3000]; int month[] = new int[12]; int day[] = new int[31]; String hob[] = new String[100]; for(int i=0;i=10 && day[i]>=10) { ScheduleDate = ""+year[i]+month[i]+day[i]; } else if(month[i]>=10 && day[i]=10) { ScheduleDate = ""+year[i]+"0"+month[i]+day[i]; } else { ScheduleDate = ""+year[i]+"0"+month[i]+"0"+day[i]; } int Date = Integer.parseInt(ScheduleDate); DATE[i] = Date; } int Rank[] = new int[n]; for (int i = 0; i < n; i++) { int rank = 1; for (int j = 0; j < n; j++) { if (DATE[i] > DATE[j]) { rank++; } } Rank[i] = rank; } int t=0; int usingArr = 0; String arr[] = new String[usingArr]; for (int i = 0; i < n; i++) { for (int j=0;j<n;j++) { if(Rank[j]==i) { usingArr+=1; }
}
for (int j=0;j<n;j++) {
if(Rank[j]==i) {
arr = new String[usingArr];
t+=1;
for (int k=0;k<usingArr;k++) {
arr[k] = hob[j];
}
}
Arrays.sort(arr);
if(t==1) {
for (int l=0;l<usingArr;l++){
System.out.println(arr[l]);
}
usingArr=0;
break;
}
}
}
}
}
댓글 입력