페이지

10984번: 내 학점을 구해줘

https://www.acmicpc.net/problem/10984


$O(tn)$


#include<cstdio>
int t;
int main() {
    scanf("%d", &t);
    while (t--) {
        int n, a, s = 0;
        float b, r = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++) scanf("%d %f", &a, &b), s += a, r += a*b;
        printf("%d %.1f\n", s, r / s);
    }
    return 0;
}

댓글 없음 :

댓글 쓰기