Initial commit
This commit is contained in:
commit
30c54f92b1
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM jenkins/jenkins:lts
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN apt-get update && apt-get install -y docker.io && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
USER jenkins
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\MaxElementAboveDiagonal\MaxElementAboveDiagonal.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
17
MaxElementAboveDiagonal.Tests/UnitTest1.cs
Normal file
17
MaxElementAboveDiagonal.Tests/UnitTest1.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace MaxElementAboveDiagonal.Tests;
|
||||||
|
|
||||||
|
public class MatrixTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void TestFindMaxAboveDiagonal()
|
||||||
|
{
|
||||||
|
int[,] matrix = {
|
||||||
|
{ 1, 2, 3 },
|
||||||
|
{ 4, 5, 6 },
|
||||||
|
{ 7, 8, 9 }
|
||||||
|
};
|
||||||
|
Assert.Equal(6, Program.FindMaxAboveDiagonal(matrix));
|
||||||
|
}
|
||||||
|
}
|
12
MaxElementAboveDiagonal/Dockerfile
Normal file
12
MaxElementAboveDiagonal/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Dockerfile
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY *.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
COPY . ./
|
||||||
|
RUN dotnet publish -c Release -o out
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/out .
|
||||||
|
ENTRYPOINT ["dotnet", "MaxElementAboveDiagonal.dll"]
|
10
MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj
Normal file
10
MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
68
MaxElementAboveDiagonal/Program.cs
Normal file
68
MaxElementAboveDiagonal/Program.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace MaxElementAboveDiagonal
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
int size = 5; // Размер матрицы
|
||||||
|
|
||||||
|
int[,] matrix = GenerateRandomMatrix(size);
|
||||||
|
PrintMatrix(matrix);
|
||||||
|
int maxElement = FindMaxAboveDiagonal(matrix);
|
||||||
|
Console.WriteLine($"Максимальный элемент выше главной диагонали: {maxElement}");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int[,] GenerateRandomMatrix(int size)
|
||||||
|
{
|
||||||
|
Random rand = new Random();
|
||||||
|
int[,] matrix = new int[size, size];
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < size; j++)
|
||||||
|
{
|
||||||
|
matrix[i, j] = rand.Next(1, 101); // Случайные числа от 1 до 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintMatrix(int[,] matrix)
|
||||||
|
{
|
||||||
|
int size = matrix.GetLength(0);
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < size; j++)
|
||||||
|
{
|
||||||
|
Console.Write($"{matrix[i, j]} ");
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FindMaxAboveDiagonal(int[,] matrix)
|
||||||
|
{
|
||||||
|
int size = matrix.GetLength(0);
|
||||||
|
int max = int.MinValue;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
for (int j = i + 1; j < size; j++) // Ищем элементы выше главной диагонали
|
||||||
|
{
|
||||||
|
if (matrix[i, j] > max)
|
||||||
|
{
|
||||||
|
max = matrix[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj",
|
||||||
|
"projectName": "MaxElementAboveDiagonal",
|
||||||
|
"projectPath": "/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj",
|
||||||
|
"packagesPath": "/root/.nuget/packages/",
|
||||||
|
"outputPath": "/root/matrix/MaxElementAboveDiagonal/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/root/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net6.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net6.0": {
|
||||||
|
"targetAlias": "net6.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net6.0": {
|
||||||
|
"targetAlias": "net6.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.135/RuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.0.6</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="/root/.nuget/packages/" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
65
MaxElementAboveDiagonal/obj/project.assets.json
Normal file
65
MaxElementAboveDiagonal/obj/project.assets.json
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"targets": {
|
||||||
|
"net6.0": {}
|
||||||
|
},
|
||||||
|
"libraries": {},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"net6.0": []
|
||||||
|
},
|
||||||
|
"packageFolders": {
|
||||||
|
"/root/.nuget/packages/": {}
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj",
|
||||||
|
"projectName": "MaxElementAboveDiagonal",
|
||||||
|
"projectPath": "/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj",
|
||||||
|
"packagesPath": "/root/.nuget/packages/",
|
||||||
|
"outputPath": "/root/matrix/MaxElementAboveDiagonal/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/root/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net6.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net6.0": {
|
||||||
|
"targetAlias": "net6.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net6.0": {
|
||||||
|
"targetAlias": "net6.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.135/RuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
MaxElementAboveDiagonal/obj/project.nuget.cache
Normal file
8
MaxElementAboveDiagonal/obj/project.nuget.cache
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "8zZAWzEzCaGQxrSoPp6LvimWHLWa9gwirNhnnVGFO+fY0ZfwcdCyDQevOI/iNKdyNo85jAlmSIVhloIsb+lHDA==",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "/root/matrix/MaxElementAboveDiagonal/MaxElementAboveDiagonal.csproj",
|
||||||
|
"expectedPackageFiles": [],
|
||||||
|
"logs": []
|
||||||
|
}
|
BIN
max-element-app.tar
Normal file
BIN
max-element-app.tar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user