왜 wa20이죠? ㅜㅜ

marong142 Reply 8 years 25 weeks ago
import java.util.Scanner; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int i, j, k; int N = sc.nextInt(); String[] employee = new String[N]; int[][] work = new int[N][7]; int[] sum = new int[N]; for(i=0; i<N; i++) sum[i]=0; for (i=0; i<N; i++){ employee[i] = sc.next(); for (j=0; j<7; j++){ work[i][j] = sc.nextInt(); } } for (i=0; i<N; i++){ for (j=0; j<7; j++){ sum[i] += work[i][j]; } } int tempInt = 0; String tempString = ""; for (i=0; i<N; i++){ for (j=i+1; j<N; j++){ if (sum[i] < sum[j]){ tempString = employee[i]; tempInt = sum[i]; employee[i] = employee[j]; sum[i] = sum[j]; employee[j] = tempString; sum[j] = tempInt; } } } for (i=0; i<N; i++){ System.out.printf("%s ", employee[i]); System.out.println(sum[i]); } } } 동점인 경우에도 잘 나오는것같은데
pichulia Reply 8 years 24 weeks ago
동점인 경우에도 잘 나오는거 같다고요? 글쎄요... 3 a 0 0 0 0 0 0 0 b 0 0 0 0 0 0 0 c 0 0 0 0 0 0 1 숫자 개수가 이게 맞나? 암튼 이걸로 테스트해보세요