минорные изменения

This commit is contained in:
Kaehvaman 2025-01-21 21:05:16 +04:00
parent 1b2ab06b3a
commit 8c2a9f885e
6 changed files with 934 additions and 872 deletions

View File

@ -44,6 +44,7 @@
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<EnableASAN>true</EnableASAN>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
@ -51,6 +52,7 @@
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<EnableASAN>false</EnableASAN>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@ -2,6 +2,10 @@
#include <stdio.h> #include <stdio.h>
#include <Windows.h> #include <Windows.h>
/*
* íå çàáóäü âêëþ÷èòü AddressSanitizer / ñàíèòàéçåð àäðåñîâ
*/
int N1; int N1;
int N2; int N2;
int M2; int M2;
@ -202,6 +206,51 @@ void task3() {
printf("> Âûïîëíåíî çàäàíèå 3\n"); printf("> Âûïîëíåíî çàäàíèå 3\n");
} }
int countRow(int* buf, int len, int target)
{
int count = 0;
for (int i = 0; i < len; i++) {
if (buf[i] == target) {
count += 1;
}
}
return 0;
}
int countColumn(int num, int column)
{
int count = 0;
for (int n = 0; n < N2; n++) {
if (A2[n][column] == num) {
count += 1;
}
}
return count;
}
// Óäàëèòü òå ñòîëáöû â êîòîðûõ âñòðå÷àåòñÿ õîòÿ áû äâà îäèíàêîâûõ ýëåìåíòà
void taskAnton()
{
for (int m = 0; m < M2; m++) {
for (int n = 0; n < N2; n++) {
if (countColumn(A2[n][m], m) > 1) {
deleteColumn(m);
m -= 1;
break;
}
}
}
printf("> Âûïîëíåíî çàäàíèå Àíòîíà\n");
}
void print1D(int* buf, int len)
{
for (int i = 0; i < len; i++) {
printf("%d ", buf[i]);
}
printf("\n");
}
int main() int main()
{ {
SetConsoleCP(1251); SetConsoleCP(1251);
@ -210,12 +259,18 @@ int main()
loadLists("test1.txt"); loadLists("test1.txt");
printLists(); printLists();
task2(); //task2();
task3(); //task3();
taskAnton();
printLists(); printLists();
//print1D(A2[1], M2);
saveLists("out.txt"); saveLists("out.txt");
while (1) {
}
return 0; return 0;
} }

View File

@ -1,5 +1,10 @@
6 6
1 2 104 106 7 8 1 2 4 6 7 8
2 4 7 2
6 4 5 1 -2 1
2 3 4 3 3 6
6 10
10 -11
9 3
2 -1
5 -8

View File

@ -1,10 +1,10 @@
6 6
1 2 4 6 7 8 1 2 4 6 7 8
7 4 7 4
-2 -1 0 1 -2 1 0 1
3 4 -5 6 3 8 -5 6
6 4 5 1 6 -4 5 10
10 -1 0 1 10 -1 0 -11
2 3 4 3 9 3 4 3
2 1 0 -1 2 1 0 -1
5 -6 7 -8 5 -6 7 -8

View File

@ -57,18 +57,6 @@ void insert(int num, int index, int arr[], int* len) {
arr[index] = num; arr[index] = num;
} }
void deletemax3(int arr[], int* len) {
int max = arr[0];
int maxi = 0;
for (int i = 1; i < *len; i++) {
if (arr[i] > max && arr[i] % 3 == 0) {
max = arr[i];
maxi = i;
}
}
deleteindex(maxi, arr, len);
}
exchange_max_chains(int A[], int B[], int* sA, int* sB) { exchange_max_chains(int A[], int B[], int* sA, int* sB) {
int a = A[0], sa = 1, ai = 0; int a = A[0], sa = 1, ai = 0;
int b = B[0], sb = 1, bi = 0; int b = B[0], sb = 1, bi = 0;
@ -116,6 +104,18 @@ exchange_max_chains(int A[], int B[], int* sA, int* sB) {
printarr(B, *sB); printarr(B, *sB);
} }
void deletemax3(int arr[], int* len) {
int max = arr[0];
int maxi = 0;
for (int i = 1; i < *len; i++) {
if (arr[i] > max && arr[i] % 3 == 0) {
max = arr[i];
maxi = i;
}
}
deleteindex(maxi, arr, len);
}
//#define ARRLEN 10 //#define ARRLEN 10
int main() { int main() {

View File

@ -558,7 +558,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (netToggle) drawNet(hdc, rect.right, rect.bottom); //drawNet(hdc, 1400, 650); if (netToggle) drawNet(hdc, rect.right, rect.bottom); //drawNet(hdc, 1400, 650);
drawImageSequence1(hdc); //drawImageSequence1(hdc);
//lab5(hdc); //lab5(hdc);
@ -570,7 +570,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//drawImageNet(hdc, 50, 50, 8, 8, 100, drawImage4); //drawImageNet(hdc, 50, 50, 8, 8, 100, drawImage4);
//drawImageSequence2(hdc, 50, 50, 12, 8, 100); drawImageSequence2(hdc, 50, 50, 12, 8, 100);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }