Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
06d76ae
Test commit. "addition" task done
EugeniusMiroshnichenko Nov 23, 2025
613b706
Test commit not in main branch
EugeniusMiroshnichenko Nov 23, 2025
2a4d55b
Trying to start pipeline
EugeniusMiroshnichenko Nov 23, 2025
ae23b13
Char changer done
EugeniusMiroshnichenko Nov 23, 2025
ac78ed1
Check flags done
EugeniusMiroshnichenko Nov 23, 2025
6d5ca5a
Legth literals done
EugeniusMiroshnichenko Nov 23, 2025
973e2c1
RMS done
EugeniusMiroshnichenko Nov 23, 2025
70b559a
Quadratic semi-done
EugeniusMiroshnichenko Nov 23, 2025
6abdaed
Merge pull request #1 from EugeniusMiroshnichenko/01-week
EugeniusMiroshnichenko Nov 23, 2025
f232d92
Changes of char_changer/test.cpp
EugeniusMiroshnichenko Nov 23, 2025
6e33054
"std::fixed" removed
EugeniusMiroshnichenko Nov 23, 2025
5040363
Print bits done
EugeniusMiroshnichenko Nov 23, 2025
c2ecb84
Print bits done
EugeniusMiroshnichenko Nov 23, 2025
5ccfcfd
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Nov 23, 2025
d16d634
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Nov 26, 2025
b5846d2
Empty commit for pipeline
EugeniusMiroshnichenko Nov 26, 2025
3140432
Re-built
EugeniusMiroshnichenko Nov 26, 2025
491b548
Removing build and .vscode folders from repo
EugeniusMiroshnichenko Nov 26, 2025
76b88a1
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
cec01a6
Func array done
EugeniusMiroshnichenko Dec 3, 2025
54e4f93
Last of us done
EugeniusMiroshnichenko Dec 3, 2025
5a5aa8e
Longest done
EugeniusMiroshnichenko Dec 3, 2025
281a806
Overload for longest added
EugeniusMiroshnichenko Dec 3, 2025
f13237b
Pretty array done
EugeniusMiroshnichenko Dec 3, 2025
8de7695
Swap pointer done
EugeniusMiroshnichenko Dec 3, 2025
6056097
Merge remote-tracking branch 'upstream/main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
2daeaf6
Debug + little big done
EugeniusMiroshnichenko Dec 3, 2025
31e8046
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
58c3ad7
Merge branch 'main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
874bb03
Returning removed test
EugeniusMiroshnichenko Dec 3, 2025
d8dc8a0
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 3, 2025
f273f6e
Merge branch 'main' into 02-week
EugeniusMiroshnichenko Dec 3, 2025
38792e3
Merge pull request #3 from EugeniusMiroshnichenko/02-week
EugeniusMiroshnichenko Dec 3, 2025
8ca841e
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 16, 2025
8f13fad
Реализация
EugeniusMiroshnichenko Dec 16, 2025
bb3be57
Временно удаляем 4 неделю
EugeniusMiroshnichenko Dec 16, 2025
7cc1249
Удаляем временно 4 неделю
EugeniusMiroshnichenko Dec 16, 2025
ded273c
Enum operators done
EugeniusMiroshnichenko Dec 18, 2025
44576c4
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 19, 2025
c2a260e
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
b170ddf
Merge remote-tracking branch 'origin/main' into 03-week
EugeniusMiroshnichenko Dec 19, 2025
8c9c865
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
72dc419
Все таки удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
4d24f6e
По другому удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
12bf2b7
Удаляем 4 неделю
EugeniusMiroshnichenko Dec 19, 2025
c8c5587
Update CMakeLists.txt
18thday Dec 19, 2025
70d105d
Merge pull request #5 from EugeniusMiroshnichenko/03-week
EugeniusMiroshnichenko Dec 19, 2025
869fe5b
Merge remote-tracking branch 'upstream/main'
EugeniusMiroshnichenko Dec 23, 2025
c268186
Возвращаем 4 неделю
EugeniusMiroshnichenko Dec 23, 2025
fdd5565
Phasor done
EugeniusMiroshnichenko Dec 23, 2025
4132904
Queue done
EugeniusMiroshnichenko Dec 23, 2025
9f310f4
Stack done
EugeniusMiroshnichenko Dec 26, 2025
7523dc1
Ring buffer done
EugeniusMiroshnichenko Dec 26, 2025
12d57d3
Красота
EugeniusMiroshnichenko Dec 26, 2025
cd94211
Merge pull request #6 from EugeniusMiroshnichenko/04_week
EugeniusMiroshnichenko Dec 26, 2025
0ad4174
Правки по 4 неделе
EugeniusMiroshnichenko Jan 22, 2026
317890c
Правки 01_week
EugeniusMiroshnichenko Jan 22, 2026
b59ffb4
Правки 02_week
EugeniusMiroshnichenko Jan 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build directories
build/
*/build/
*/build*/

# IDE
.vscode/
2 changes: 1 addition & 1 deletion 01_week/tasks/addition/addition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


int64_t Addition(int a, int b) {
throw std::runtime_error{"Not implemented"};
return static_cast<int64_t>(a) + b;
}
2 changes: 1 addition & 1 deletion 01_week/tasks/char_changer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1. Строчные латинские символы заменяются на прописные, правило 1 действует
1. Последовательные пробельные символы, заменяются на один без указания числа
повторений и преобразуются в заданный извне разделитель `delimeter`.
1. Все остальные символы заменяются на символ `_`
1. Все остальные символы заменяются на символ `_`. Правило 1 действует

Гарантируется, что последний символ в массиве `'\0'`.

Expand Down
51 changes: 49 additions & 2 deletions 01_week/tasks/char_changer/char_changer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,54 @@
#include <cstddef>
#include <stdexcept>
#include <cctype>

void ProcessOneSymbol(char* array, size_t& pos, char symbol, size_t count){
array[pos] = symbol;
if (count >= 10){
++pos;
array[pos] = '0';
}
else if (count > 1){
++pos;
array[pos] = count + '0';
}
}

size_t CharChanger(char array[], size_t size, char delimiter = ' ') {
throw std::runtime_error{"Not implemented"};
size_t Counter(char array[], size_t size, size_t startIdx){
char symbol = array[startIdx];
size_t count = 1;
for (size_t i = startIdx + 1; i < size - 1; ++i) {
if (array[i] == symbol) ++count;
else break;
}
return count;
}

size_t CharChanger(char array[], size_t size, char delimiter = ' ') {
size_t count = 0;
size_t new_ar_pos = 0;
for (size_t i=0; i<size-1;){
count = Counter(array, size, i);

if (std::isblank(array[i])){
array[new_ar_pos] = delimiter;
}
else if (std::isdigit(array[i])){
ProcessOneSymbol(array, new_ar_pos, '*', count);
}
else if (std::islower(array[i])){
ProcessOneSymbol(array, new_ar_pos, std::toupper(array[i]), count);
}
else if (std::isupper(array[i])){
ProcessOneSymbol(array, new_ar_pos, array[i], count);
}
else{
ProcessOneSymbol(array, new_ar_pos, '_', count);
}
i += count;
++new_ar_pos;
}

array[std::min(new_ar_pos, size - 1)] = '\0';
return new_ar_pos;
}
24 changes: 23 additions & 1 deletion 01_week/tasks/check_flags/check_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,27 @@ enum class CheckFlags : uint8_t {
};

void PrintCheckFlags(CheckFlags flags) {
throw std::runtime_error{"Not implemented"};
uint8_t flags_int = static_cast<uint8_t>(flags);
if (flags_int > static_cast<uint8_t>(CheckFlags::ALL)) {
std::cout << "";
return;
}

std::string names[6] = {"TIME", "DATE", "USER", "CERT", "KEYS" , "DEST"};
std::string result = "[";
bool symbol_added = false;

uint8_t mask = 1;
for (size_t i = 0; i < 6; ++i) {
mask = (1 << i);
if (flags_int & mask) {
if (symbol_added) {
result += ",";
}
result += names[i];
symbol_added = true;
}
}

std::cout << result + "]";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хорошее решение задачи

}
53 changes: 53 additions & 0 deletions 01_week/tasks/length_lit/length_lit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace{
constexpr double FT_IN_M = 3.280839895;
constexpr double IN_IN_FT = 12.0;
constexpr double IN_IN_M = IN_IN_FT * FT_IN_M;
}

constexpr double operator""_m_to_cm(long double meters){
return meters * 100;
}

constexpr double operator""_cm_to_m(long double centimeter){
return centimeter / 100.0;
}

constexpr double operator""_ft_to_m(long double feets){
return feets / FT_IN_M;
}

constexpr double operator""_ft_to_cm(long double feets){
return operator""_m_to_cm(operator""_ft_to_m(feets));
}

constexpr double operator""_ft_to_in(long double feets){
return feets * IN_IN_FT;
}

constexpr double operator""_in_to_m(long double inches){
return inches / IN_IN_M;
}

constexpr double operator""_in_to_cm(long double inches){
return operator""_m_to_cm(operator""_in_to_m(inches));
}

constexpr double operator""_in_to_ft(long double inches){
return inches / IN_IN_FT;
}

constexpr double operator""_m_to_ft(long double meters){
return meters * FT_IN_M;
}

constexpr double operator""_m_to_in(long double meters){
return meters * IN_IN_M;
}

constexpr double operator""_cm_to_ft(long double centimeters){
return operator""_cm_to_m(operator""_m_to_ft(centimeters));
}

constexpr double operator""_cm_to_in(long double centimeters){
return operator""_cm_to_m(operator""_m_to_in(centimeters));
}
15 changes: 14 additions & 1 deletion 01_week/tasks/print_bits/print_bits.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#include <cstddef>
#include <stdexcept>
#include <iostream>


void PrintBits(long long value, size_t bytes) {
throw std::runtime_error{"Not implemented"};
std::string result = "0b";
size_t total_bits = bytes * 8;
long long mask = 0LL;
// Тут надо int, иначе условие бесконечное, потому что будет
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

все зависит от условия и действий, но можно и с int

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В рамках данной задачи, да

// происходит переполнение счетчика
for (int i = total_bits - 1; i >= 0; --i) {
mask = 1LL << i;

result += (value & mask) ? '1' : '0';

if (i % 4 == 0 && i != 0) result += '\'';
}
std::cout << result << "\n";
}
57 changes: 56 additions & 1 deletion 01_week/tasks/quadratic/quadratic.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
#include <stdexcept>
#include <cmath>
#include <iomanip>
#include <iostream>

bool isLevelLine(int a, int b) {
return a == 0 && b == 0;
}

bool isLinear(int a, int b){
if (a == 0 && b != 0) return true;
else return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

очень сомнительная конструкция, если true то верни true, иначе (если false) верни false
просто вернуть результат выражения

Copy link

@EugeniusMiroshnichenko EugeniusMiroshnichenko Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перемудрил
317890c


}

bool isQuadratic(int a){
if (a != 0) return true;
else return false;

}

std::string AddRootToStr(double x){
std::ostringstream oss;
oss << std::setprecision(6);
if (std::abs(x - std::round(x)) < 1e-10) {
oss << static_cast<int>(std::round(x));
} else {
oss << x;
}
return oss.str();
}

void SolveQuadratic(int a, int b, int c) {
throw std::runtime_error{"Not implemented"};
std::string result = "";
if (isLevelLine(a, b)){
result = (c == 0) ? "infinite solutions" : "no solutions";
}
else if (isLinear(a, b)){
double x = -static_cast<double>(c) / b;
result = AddRootToStr(x);
}
else if (isQuadratic(a)){
double discr = b * b - 4 * a * c;
if (discr < 0) {
result = "no solutions";
}
else if (std::abs(discr) < 1e-10) {
double x = -b / (2.0 * a);
result = AddRootToStr(x);
}
else {
double x1 = (-b + sqrt(discr)) / (2.0 * a);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::sqrt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Взято из cmath

double x2 = (-b - sqrt(discr)) / (2.0 * a);

if (x1 > x2) std::swap(x1, x2);
result = AddRootToStr(x1) + " " + AddRootToStr(x2);
}
}

std::cout << result;
}
11 changes: 8 additions & 3 deletions 01_week/tasks/rms/rms.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include <cstdef>
#include <stdexcept>
#include <cstddef>
#include <cmath>


double CalculateRMS(double values[], size_t size) {
throw std::runtime_error{"Not implemented"};
double res = 0.0;
if (values == nullptr || size == 0) return res;
for (size_t i = 0; i < size; ++i){
res += values[i] * values[i];
}
return std::sqrt(res / size);
}
12 changes: 10 additions & 2 deletions 02_week/tasks/func_array/func_array.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include <stdexcept>


double ApplyOperations(double a, double b /* other arguments */) {
throw std::runtime_error{"Not implemented"};
double ApplyOperations(double a, double b, double (*functions[])(double, double), size_t func_count) {
double result = 0.0;
const double& a_ref = a;
const double& b_ref = b;
for (size_t i = 0; i < func_count; ++i){
if (functions[i]){
result += functions[i](a_ref, b_ref);
}
}
return result;
}
17 changes: 15 additions & 2 deletions 02_week/tasks/last_of_us/last_of_us.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#include <stdexcept>


/* return_type */ FindLastElement(/* ptr_type */ begin, /* ptr_type */ end, /* func_type */ predicate) {
throw std::runtime_error{"Not implemented"};
const int* FindLastElement(const int* begin, const int* end, bool (*predicate)(int)) {
const int* result = end;
if ((begin == nullptr) || (end==nullptr) || (predicate == nullptr) || (begin > end)) {
result = end;
return result;
}

for (; begin != end; ++begin){
const int elem = *begin;
if (predicate(elem)){
result = begin;
}
}

return result;
}
26 changes: 22 additions & 4 deletions 02_week/tasks/little_big/little_big.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>

void Print(unsigned char* byte_ptr, size_t bytes, bool shouldInverse){
std::ostringstream oss;
oss << "0x";

for (size_t i = 0; i < bytes; ++i) {
size_t index = shouldInverse ? (bytes - 1 - i) : i;
oss << std::hex << std::uppercase << std::setw(2) << std::setfill('0')
<< static_cast<int>(byte_ptr[index]);
}

oss << "\n";
std::cout << oss.str();
}

void PrintMemory(int /* write arguments here */) {
throw std::runtime_error{"Not implemented"};
void PrintMemory(int number, bool shouldInverse=false) {
unsigned char* byte_ptr = reinterpret_cast<unsigned char*>(&number);
Print(byte_ptr, sizeof(int), shouldInverse);
}

void PrintMemory(double /* write arguments here */) {
throw std::runtime_error{"Not implemented"};
void PrintMemory(double number, bool shouldInverse=false) {
unsigned char* byte_ptr = reinterpret_cast<unsigned char*>(&number);
Print(byte_ptr, sizeof(double), shouldInverse);
}
35 changes: 33 additions & 2 deletions 02_week/tasks/longest/longest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
#include <stdexcept>


/* return_type */ FindLongestSubsequence(/* ptr_type */ begin, /* ptr_type */ end, /* type */ count) {
throw std::runtime_error{"Not implemented"};
const char* FindLongestSubsequence(const char* begin, const char* end, size_t& count) {
const char* start_of_longest_seq = nullptr;
count = 0;
size_t this_seq_count = 0;

if ((begin == nullptr) || (end==nullptr) || (begin > end)) {
return start_of_longest_seq;
}

const char* next_el = nullptr;
while(begin != end){
this_seq_count = 1;
if (begin < end - 1){
next_el = begin + 1;
for (; next_el != end; ++next_el){
if (*next_el != *begin) break;
++this_seq_count;
}
}

if (this_seq_count > count){
count = this_seq_count;
start_of_longest_seq = begin;
}
begin += this_seq_count;
}

return start_of_longest_seq;
}

char* FindLongestSubsequence(char* begin, char* end, size_t& count){
const char* const_result = FindLongestSubsequence(const_cast<const char*>(begin), const_cast<const char*>(end), count);
return const_cast<char*>(const_result);
}
Loading