[문제] / URL : https://www.acmicpc.net/problem/5596

[C# 코드]
using System;
namespace baek5596
{
class Program
{
static int getTotalScore(int[] nums, int index)
{
if (index == nums.Length)
{
return 0;
}
return nums[index] + getTotalScore(nums, index + 1);
}
static void Main(string[] args)
{
int[] minGookScores = new int[4];
int[] jungboScores = new int[4];
for (int i = 0; i < 2; i++)
{
string[] lines = Console.ReadLine().Split();
if (i == 0)
{
for (int j = 0; j < 4; j++)
{
minGookScores[j] = int.Parse(lines[j]);
}
}
else if (i == 1)
{
for (int j = 0; j < 4; j++)
{
jungboScores[j] = int.Parse(lines[j]);
}
}
}
int minGookTotalScore = getTotalScore(minGookScores, 0);
int jungboTotalScore = getTotalScore(jungboScores, 0);
if (minGookTotalScore >= jungboTotalScore)
{
Console.WriteLine(minGookTotalScore);
}
else
{
Console.WriteLine(jungboTotalScore);
}
}
}
}
'알고리즘 문제 풀이' 카테고리의 다른 글
[백준 알고리즘] C# 이상한곱셈, 1225번 (0) | 2021.07.23 |
---|---|
[프로그래머스] C# 음양 더하기 (0) | 2021.07.23 |
[백준 알고리즘] C# 운동 1173번 (0) | 2021.07.22 |
[4344번] 평균은 넘겠지 (0) | 2020.01.10 |
[3052번] 나머지 (0) | 2020.01.07 |