2508/3000 #3

Merged
mhhung merged 2 commits from 2508/3000 into main 2025-08-26 06:24:03 +00:00
2 changed files with 48 additions and 0 deletions
Showing only changes of commit 174dd451da - Show all commits

View File

@@ -0,0 +1,38 @@
public class Solution
{
public int AreaOfMaxDiagonal(int[][] dimensions)
{
int max = 0;
int maxArea = 0;
foreach (var dimension in dimensions)
{
var dimensionSqrt = dimension[0] * dimension[0] + dimension[1] * dimension[1];
var area = dimension[0] * dimension[1];
if (dimensionSqrt > max)
{
max = dimensionSqrt;
maxArea = area;
}
else if (dimensionSqrt == max)
{
maxArea = Math.Max(maxArea, area);
}
}
return maxArea;
}
}
public class Program
{
public static void Main()
{
var Solution = new Solution();
var dimensions = new int[][] { [6,5],[8,6],[2,10],[8,1],[9,2],[3,5],[3,5]};
var result = Solution.AreaOfMaxDiagonal(dimensions);
Console.WriteLine(result);
}
}

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>