백준 1546 평균
Console Programming/C# Console 2019. 10. 15. 17:50using System;
namespace _1546
{
class Program
{
static void Main(string[] args)
{
int testCaseNum = int.Parse(Console.ReadLine());
string[] strInput = Console.ReadLine().Split(' ');
int[] intInput = new int[testCaseNum];
for (int i = 0; i < testCaseNum; i++)
{
intInput[i] = int.Parse(strInput[i]);
}
int max = intInput[0];
foreach (int val in intInput)
{
if (val > max)
{
max = val;
}
}
double sum=0;
foreach(double score in intInput)
{
sum += (score/max) * 100;
}
double result = sum / testCaseNum;
Console.WriteLine(result);
}
}
}
'Console Programming > C# Console' 카테고리의 다른 글
2019-10-15 17일차 팝업패널 제작 (0) | 2019.10.15 |
---|---|
백준 10818 최소 최대 (0) | 2019.10.15 |
백준 2577 숫자의 개수 (0) | 2019.10.15 |
2019-10-14 UIPanel 과 Data 클래스 만들기 (수정본) (0) | 2019.10.14 |
2019-10-14 UIPanel 과 Data 클래스 만들기 (0) | 2019.10.14 |