mirror of
https://github.com/KhasanovAMdev/ISTU_TEST_LR1.git
synced 2026-02-03 03:49:36 +04:00
Код задачи
This commit is contained in:
10
LR1/AppTesting/AppTesting.csproj
Normal file
10
LR1/AppTesting/AppTesting.csproj
Normal 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>
|
||||
48
LR1/AppTesting/Program.cs
Normal file
48
LR1/AppTesting/Program.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
internal class Program
|
||||
{
|
||||
private static float[] inputArray = {
|
||||
1.5f, -2.4f, 3.1f, 0.5f, 12.7f, -8.2f, 4.4f, 9.0f, 01511.0f
|
||||
};
|
||||
private static void Main()
|
||||
{
|
||||
Console.WriteLine($"Массив с входными данными: [{string.Join("; ", inputArray)}]");
|
||||
|
||||
var outputData = ArrayProc(inputArray);
|
||||
|
||||
Console.WriteLine($"Массив с выходными данными: [{string.Join("; ", outputData ?? Array.Empty<float>())}]");
|
||||
}
|
||||
|
||||
|
||||
private static float[]? ArrayProc(float[] inputData)
|
||||
{
|
||||
float[] outputArray;
|
||||
int pairs = 0;
|
||||
int n = inputData.Length - 1;
|
||||
for (int i = 0; i <= n / 2; i++)
|
||||
{
|
||||
if (i + 8 <= n) pairs++;
|
||||
}
|
||||
|
||||
if (pairs == 0)
|
||||
{
|
||||
Console.WriteLine("Размер массива не соответствует условию");
|
||||
return null;
|
||||
}
|
||||
|
||||
outputArray = new float[pairs];
|
||||
|
||||
for (int i = 8, j = 0; j < outputArray.Length; j++, i++)
|
||||
{
|
||||
outputArray[j] = inputData[i] * inputData[i - 8];
|
||||
}
|
||||
|
||||
if (outputArray.Length % 2 != 0)
|
||||
{
|
||||
int centralIdx = outputArray.Length / 2;
|
||||
float centralItem = outputArray[centralIdx];
|
||||
outputArray[centralIdx] = centralItem * centralItem;
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
|
||||
}
|
||||
1
LR1/DataGeneration/DataGeneration.py
Normal file
1
LR1/DataGeneration/DataGeneration.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
35
LR1/DataGeneration/DataGeneration.pyproj
Normal file
35
LR1/DataGeneration/DataGeneration.pyproj
Normal file
@@ -0,0 +1,35 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>3032cd08-5b57-4966-95ce-53274d36ce2e</ProjectGuid>
|
||||
<ProjectHome>.</ProjectHome>
|
||||
<StartupFile>DataGeneration.py</StartupFile>
|
||||
<SearchPath>
|
||||
</SearchPath>
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<Name>DataGeneration</Name>
|
||||
<RootNamespace>DataGeneration</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataGeneration.py" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
||||
<!-- Uncomment the CoreCompile target to enable the Build command in
|
||||
Visual Studio and specify your pre- and post-build commands in
|
||||
the BeforeBuild and AfterBuild targets below. -->
|
||||
<!--<Target Name="CoreCompile" />-->
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
</Project>
|
||||
29
LR1/LR1.sln
Normal file
29
LR1/LR1.sln
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36705.20 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppTesting", "AppTesting\AppTesting.csproj", "{A02E459C-F603-4AC3-BEA4-00610EB22632}"
|
||||
EndProject
|
||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "DataGeneration", "DataGeneration\DataGeneration.pyproj", "{3032CD08-5B57-4966-95CE-53274D36CE2E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A02E459C-F603-4AC3-BEA4-00610EB22632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A02E459C-F603-4AC3-BEA4-00610EB22632}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A02E459C-F603-4AC3-BEA4-00610EB22632}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A02E459C-F603-4AC3-BEA4-00610EB22632}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3032CD08-5B57-4966-95CE-53274D36CE2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3032CD08-5B57-4966-95CE-53274D36CE2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {050145E8-D62B-4F8B-BF2D-42F9B6820BEE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user