"SWEA 1983 조교의 성적 매기기"의 두 판 사이의 차이

18번째 줄: 18번째 줄:
public class Solution {
public class Solution {
     public static void main(String args[]) {
     public static void main(String args[]) {
        final String grades[] = {"A+","A0","A-","B+","B0","B-","C+","C0","C-","D0"};
         Scanner sc = new Scanner(System.in);
         Scanner sc = new Scanner(System.in);
        final String grades[] = {"A+","A0","A-","B+","B0","B-","C+","C0","C-","D0"};
         int T = sc.nextInt();
         int T = sc.nextInt();
         for(int t=1; t<=T; t++) {
         for(int t=1; t<=T; t++) {

2018년 9월 8일 (토) 16:33 판

1 개요

SWEA 1983 조교의 성적 매기기
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 2-1

2 C++

3 Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
public class Solution {
    public static void main(String args[]) {
        final String grades[] = {"A+","A0","A-","B+","B0","B-","C+","C0","C-","D0"};
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int t=1; t<=T; t++) {
            int n = sc.nextInt();
            int k = sc.nextInt()-1;
            Integer a[] = new Integer[n];
            for(int i=0; i<n; i++) {
                int mid = sc.nextInt(); 
                int fin = sc.nextInt();
                int hom = sc.nextInt();
                a[i] = mid*35 + fin*45 + hom*20;
            }
            int k_score = a[k];
            Arrays.sort(a, Collections.reverseOrder());
            int k_rank = Arrays.asList(a).indexOf(k_score);
            System.out.format("#%d %s\n", t, grades[10*k_rank/n]);
        }
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}