코딩 테스트 문제 풀이
백준 파이썬 10984번: 내 학점을 구해줘
tturbo0824
2021. 3. 29. 23:07
10984번: 내 학점을 구해줘
게으른 근우는 열심히 놀다가 문득, 자신의 학점 평균이 얼마일지 궁금해졌다. 학사시스템도 들어가기 귀찮아하는 근우를 위해 구해주도록 하자.
www.acmicpc.net
문제 유형: 수학, 구현, 사칙연산
# Solution 1
import sys
input = sys.stdin.readline
for _ in range(int(input())):
credit = 0
total = 0
for _ in range(int(input())):
C, G = map(float, input().split())
credit += int(C)
total += C * G
GPA = total / credit
print(credit, '%.1f'%GPA)