본문 바로가기
알고리즘/문제풀이

sw Expert Academy D2 조교의 성적 매기기

by 새싹감자 2022. 7. 29.
for q in range(testcase):
    #n명수, target 알고싶은애 번호
    n,target = map(int,input().split())
    gradenum=int(n/10)
    score=[]
    result=[[0]* 2 for _ in range(n)]
    resultin=[[0]* 2 for _ in range(n)]

    grade=[]
    for i in range(n):
        score.append(list(map(int,input().split())))

    print('#{} '.format(q+1),end='')
    for i in range(n):
        result[i][0]=i+1
        result[i][1]=score[i][0]*0.35+score[i][1]*0.45+score[i][2]*0.2

    result.sort(key= lambda x:-x[1])
    gradealpha=['A+','A0','A-','B+','B0','B-','C+','C0','C-','D0']
    for z in range(10):
        for i in range(gradenum*z,gradenum*(z+1)):
            resultin[i][0] = result[i][0]
            resultin[i][1] = gradealpha[z]

    for i in range(n):
        if (target==resultin[i][0]):
            print(resultin[i][1])

댓글