mirror of
https://github.com/KhasanovAMdev/ISTU_TEST_LR1.git
synced 2026-02-03 02:39:37 +04:00
Compare commits
5 Commits
d1d057bed5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fd2ea4aea | |||
| a7b9c3409e | |||
| 6e5fa35376 | |||
| ed69e99972 | |||
| de9e401e8e |
31
.github/workflows/main.yml
vendored
Normal file
31
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Autotests CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
test-job:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
working-directory: ./LR1
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
working-directory: ./LR1
|
||||
|
||||
- name: Run unit tests
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
working-directory: ./LR1
|
||||
@@ -1,18 +1,37 @@
|
||||
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
|
||||
};
|
||||
1.5f, -2.4f, 3.1f, 0.5f, 12.7f, -8.2f, 4.4f, 9.0f, 0.0f, 11.1f,
|
||||
-3.3f, 6.7f, 15.2f, 2.8f, 7.0f, -1.1f, 4.9f, 8.3f, 22.5f, 0.2f,
|
||||
5.6f, -9.4f, 13.0f, 1.1f, 3.7f, 18.2f, -4.5f, 6.0f, 0.9f, 10.4f,
|
||||
2.2f, -7.7f, 14.1f, 3.3f, 5.8f, 21.0f, -0.5f, 8.8f, 1.4f, 12.3f,
|
||||
4.0f, -6.1f, 17.5f, 2.9f, 9.2f, 19.8f, -2.2f, 7.4f, 0.3f, 11.9f
|
||||
};
|
||||
|
||||
private static void Main()
|
||||
{
|
||||
Console.WriteLine($"Массив с входными данными: [{string.Join("; ", inputArray)}]");
|
||||
|
||||
var outputData = ArrayProc(inputArray);
|
||||
var minValue = SearchMinValue(outputData);
|
||||
|
||||
Console.WriteLine($"Массив с выходными данными: [{string.Join("; ", outputData ?? Array.Empty<float>())}]");
|
||||
Console.WriteLine($"Минимальное значенние: {minValue.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
private static float SearchMinValue(float[]? inputData)
|
||||
{
|
||||
if (inputData == null || inputData.Length == 0) return 0;
|
||||
|
||||
var minValue = inputData[0];
|
||||
for (int i = 1; i < inputData.Length; i++)
|
||||
{
|
||||
if (inputData[i] < minValue) minValue = inputData[i];
|
||||
}
|
||||
return minValue;
|
||||
}
|
||||
|
||||
private static float[]? ArrayProc(float[] inputData)
|
||||
{
|
||||
float[] outputArray;
|
||||
|
||||
@@ -1 +1,24 @@
|
||||
import random
|
||||
import struct
|
||||
|
||||
MIN_FLOAT = -3.4028235e38
|
||||
MAX_FLOAT = 3.4028235e38
|
||||
|
||||
def generate_and_solve():
|
||||
length = random.randint(0, 1024)
|
||||
input_data = [random.uniform(MIN_FLOAT, MAX_FLOAT) for _ in range(length)]
|
||||
|
||||
n = len(input_data) - 1
|
||||
limit = n // 2
|
||||
pairs = []
|
||||
for i in range(limit + 1):
|
||||
if i + 8 <= n:
|
||||
pairs.append(input_data[i] * input_data[i+8])
|
||||
|
||||
if len(pairs) % 2 != 0:
|
||||
mid = len(pairs) // 2
|
||||
pairs[mid] = pairs[mid] ** 2
|
||||
|
||||
|
||||
|
||||
generate_and_solve()
|
||||
|
||||
Reference in New Issue
Block a user