[백준] C# : 내 학점을 구해줘 (10984번)

ssu_hyun·2022년 8월 15일
0

Data Structure & Algorithm

목록 보기
55/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for (int i=0; i<t; i++)
            {
                int c = 0;
                float g = 0;
                int n = int.Parse(Console.ReadLine());
                for (int j=0; j<n; j++)
                {
                    string[] s = Console.ReadLine().Split();
                    c += int.Parse(s[0]);
                    g += int.Parse(s[0]) * float.Parse(s[1]);                                                                 
                }
                Console.WriteLine($"{c} {Math.Round(g/c, 1)}");
            }

        }
    }
}

0개의 댓글