mirror of
https://github.com/Kaehvaman/OAIP.git
synced 2025-01-31 01:08:25 +04:00
минорные изменения
This commit is contained in:
parent
1b2ab06b3a
commit
8c2a9f885e
@ -44,6 +44,7 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
@ -51,6 +52,7 @@
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -2,6 +2,10 @@
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
/*
|
||||
* íå çàáóäü âêëþ÷èòü AddressSanitizer / ñàíèòàéçåð àäðåñîâ
|
||||
*/
|
||||
|
||||
int N1;
|
||||
int N2;
|
||||
int M2;
|
||||
@ -202,6 +206,51 @@ void task3() {
|
||||
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()
|
||||
{
|
||||
SetConsoleCP(1251);
|
||||
@ -210,12 +259,18 @@ int main()
|
||||
loadLists("test1.txt");
|
||||
printLists();
|
||||
|
||||
task2();
|
||||
task3();
|
||||
//task2();
|
||||
//task3();
|
||||
taskAnton();
|
||||
|
||||
printLists();
|
||||
//print1D(A2[1], M2);
|
||||
|
||||
saveLists("out.txt");
|
||||
|
||||
while (1) {
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
6
|
||||
1 2 104 106 7 8
|
||||
2 4
|
||||
6 4 5 1
|
||||
2 3 4 3
|
||||
1 2 4 6 7 8
|
||||
7 2
|
||||
-2 1
|
||||
3 6
|
||||
6 10
|
||||
10 -11
|
||||
9 3
|
||||
2 -1
|
||||
5 -8
|
||||
|
@ -1,10 +1,10 @@
|
||||
6
|
||||
1 2 4 6 7 8
|
||||
7 4
|
||||
-2 -1 0 1
|
||||
3 4 -5 6
|
||||
6 4 5 1
|
||||
10 -1 0 1
|
||||
2 3 4 3
|
||||
-2 1 0 1
|
||||
3 8 -5 6
|
||||
6 -4 5 10
|
||||
10 -1 0 -11
|
||||
9 3 4 3
|
||||
2 1 0 -1
|
||||
5 -6 7 -8
|
@ -57,18 +57,6 @@ void insert(int num, int index, int arr[], int* len) {
|
||||
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) {
|
||||
int a = A[0], sa = 1, ai = 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);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
int main() {
|
||||
|
@ -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);
|
||||
|
||||
drawImageSequence1(hdc);
|
||||
//drawImageSequence1(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);
|
||||
|
||||
//drawImageSequence2(hdc, 50, 50, 12, 8, 100);
|
||||
drawImageSequence2(hdc, 50, 50, 12, 8, 100);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user