From 60a7ef49992dfb77c2ee3b8d02c56be582e72100 Mon Sep 17 00:00:00 2001 From: Kristian Todorov <63777932+kristian3551@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:13:58 +0300 Subject: solved ex 8 and 9 from sem. 3 --- Sem. 03/exercise 8 - dollar pyramid.cpp | 17 +++++++++++++++++ Sem. 03/exercise 9 - rightmost pyramid.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Sem. 03/exercise 8 - dollar pyramid.cpp create mode 100644 Sem. 03/exercise 9 - rightmost pyramid.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/exercise 8 - dollar pyramid.cpp b/Sem. 03/exercise 8 - dollar pyramid.cpp new file mode 100644 index 0000000..e32c5ba --- /dev/null +++ b/Sem. 03/exercise 8 - dollar pyramid.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; + +void printPyramid(int n) { + for(int i = 1; i <= n; i++) { + for(int j = 1; j <= i; j++) + cout << "$" << " "; // print as many dollars as the number of the current row + cout << endl; + } +} + +int main() { + int n; + cin >> n; + printPyramid(n); + return 0; +} \ No newline at end of file diff --git a/Sem. 03/exercise 9 - rightmost pyramid.cpp b/Sem. 03/exercise 9 - rightmost pyramid.cpp new file mode 100644 index 0000000..f966fa2 --- /dev/null +++ b/Sem. 03/exercise 9 - rightmost pyramid.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; + +void printRightmostPyramid(int n) { + // print the first part of the pyramid (the one going from 1 to n(n-1)...21) + for(int i = 1; i <= n; i++) { + for(int k = n - i; k >= 0; k--) cout << " "; // print the spaces + for(int j = i; j >= 1; j--) cout << j; // print numbers j(j - 1)...21 + cout << endl; + } + // print the first part of the pyramid (the one going from (n-1)...21 to 1 + for(int i = n - 1; i >= 1; i--) { + for(int k = n - i; k >= 0; k--) cout << " "; + for(int j = i; j >= 1; j--) cout << j; + cout << endl; + } +} + +int main() { + int n; + cin >> n; + printRightmostPyramid(n); + return 0; +} \ No newline at end of file -- cgit v1.3.1-23-gd82d From 616692d1e3605bbc77754c90434b82eb6b41c1d8 Mon Sep 17 00:00:00 2001 From: Kristian Todorov <63777932+kristian3551@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:45:14 +0300 Subject: solved ex 8 and 9 from sem. 3 --- Sem. 03/exercise 8 - dollar pyramid.cpp | 17 ---------- Sem. 03/exercise 9 - rightmost pyramid.cpp | 24 --------------- Sem. 03/solutions/exercise 8 - dollar pyramid.cpp | 19 ++++++++++++ .../solutions/exercise 9 - rightmost pyramid.cpp | 36 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 41 deletions(-) delete mode 100644 Sem. 03/exercise 8 - dollar pyramid.cpp delete mode 100644 Sem. 03/exercise 9 - rightmost pyramid.cpp create mode 100644 Sem. 03/solutions/exercise 8 - dollar pyramid.cpp create mode 100644 Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/exercise 8 - dollar pyramid.cpp b/Sem. 03/exercise 8 - dollar pyramid.cpp deleted file mode 100644 index e32c5ba..0000000 --- a/Sem. 03/exercise 8 - dollar pyramid.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using namespace std; - -void printPyramid(int n) { - for(int i = 1; i <= n; i++) { - for(int j = 1; j <= i; j++) - cout << "$" << " "; // print as many dollars as the number of the current row - cout << endl; - } -} - -int main() { - int n; - cin >> n; - printPyramid(n); - return 0; -} \ No newline at end of file diff --git a/Sem. 03/exercise 9 - rightmost pyramid.cpp b/Sem. 03/exercise 9 - rightmost pyramid.cpp deleted file mode 100644 index f966fa2..0000000 --- a/Sem. 03/exercise 9 - rightmost pyramid.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using namespace std; - -void printRightmostPyramid(int n) { - // print the first part of the pyramid (the one going from 1 to n(n-1)...21) - for(int i = 1; i <= n; i++) { - for(int k = n - i; k >= 0; k--) cout << " "; // print the spaces - for(int j = i; j >= 1; j--) cout << j; // print numbers j(j - 1)...21 - cout << endl; - } - // print the first part of the pyramid (the one going from (n-1)...21 to 1 - for(int i = n - 1; i >= 1; i--) { - for(int k = n - i; k >= 0; k--) cout << " "; - for(int j = i; j >= 1; j--) cout << j; - cout << endl; - } -} - -int main() { - int n; - cin >> n; - printRightmostPyramid(n); - return 0; -} \ No newline at end of file diff --git a/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp b/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp new file mode 100644 index 0000000..65f6106 --- /dev/null +++ b/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; + +int main() +{ + + int n; + cin >> n; + + for(int i = 1; i <= n; i++) + { + for(int j = 1; j <= i; j++) + cout << "$" << " "; // print as many dollars as the number of the current row + + cout << endl; + } + + return 0; +} \ No newline at end of file diff --git a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp new file mode 100644 index 0000000..80408ac --- /dev/null +++ b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; + +int main() +{ + + int n; + cin >> n; + + // print the first part of the pyramid (the one going from 1 to n(n-1)...21) + + for(int i = 1; i <= n; i++) + { + for(int k = n - i; k >= 0; k--) + cout << " "; // print the spaces + + for(int j = i; j >= 1; j--) + cout << j; // print numbers j(j - 1)...21 + + cout << endl; + } + // print the first part of the pyramid (the one going from (n-1)...21 to 1 + + for(int i = n - 1; i >= 1; i--) + { + for(int k = n - i; k >= 0; k--) + cout << " "; + + for(int j = i; j >= 1; j--) + cout << j; + + cout << endl; + } + + return 0; +} \ No newline at end of file -- cgit v1.3.1-23-gd82d From 7b293489a228d03fb295f5f9e12e6f8da5854cc1 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 09:46:46 -0400 Subject: Update README.md --- Sem. 03/README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index 6fcb143..659c710 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -112,6 +112,7 @@ do *Вход: 0 0 -1 5 -6 Изход: 2 3* +**!** Задачите надолу са за рисуване на конзолата. Във файла *drawing_examples.txt* има изходите като текст. **Задача 8:** Да се напише програма, която приема цяло положително число n и отпечатва следната пирамида от доларчета -- cgit v1.3.1-23-gd82d From 06934b13b40ed298a23ae4776b35267e43b87ca4 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 09:47:50 -0400 Subject: Update README.md --- Sem. 03/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index 659c710..427d736 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -112,7 +112,7 @@ do *Вход: 0 0 -1 5 -6 Изход: 2 3* -**!** Задачите надолу са за рисуване на конзолата. Във файла *drawing_examples.txt* има изходите като текст. +**!!** Задачите надолу са за рисуване на конзолата. Във файла *drawing_examples.txt* има изходите като текст.**!!** **Задача 8:** Да се напише програма, която приема цяло положително число n и отпечатва следната пирамида от доларчета -- cgit v1.3.1-23-gd82d From 37407ad35d0c5e19a69d4154d54be2f14450474b Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 09:48:56 -0400 Subject: Update drawing_examples.txt --- Sem. 03/drawing_examples.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sem. 03') diff --git a/Sem. 03/drawing_examples.txt b/Sem. 03/drawing_examples.txt index 5179a0f..d8fad73 100644 --- a/Sem. 03/drawing_examples.txt +++ b/Sem. 03/drawing_examples.txt @@ -63,7 +63,7 @@ $ $ $ $ задача 11: -вход:9 +вход:3 1 2 3 6 5 4 7 8 9 -- cgit v1.3.1-23-gd82d From 9d1770ff8d52a99a68c414a5030366a2aec3c3a1 Mon Sep 17 00:00:00 2001 From: Стоян Златев <47269030+Tony5768@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:02:43 +0300 Subject: Create example 10 - matrix --- Sem. 03/example 10 - matrix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Sem. 03/example 10 - matrix (limited to 'Sem. 03') diff --git a/Sem. 03/example 10 - matrix b/Sem. 03/example 10 - matrix new file mode 100644 index 0000000..dae43ab --- /dev/null +++ b/Sem. 03/example 10 - matrix @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() +{ + int count; + cin >> count; + + for (int i = 1; i <= count; i++) + { + for (int j = 0; j < count; j++) + { + if (j % 2 == 0) + { + cout << i + (count * j) << " "; + } + else + { + cout << (j + 1) * count - (i - 1) << " "; + } + } + cout << endl; + } +} -- cgit v1.3.1-23-gd82d From 2f718a73d9226759f98d7d631f0d43ba180c5919 Mon Sep 17 00:00:00 2001 From: Kristian Todorov <63777932+kristian3551@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:04:06 +0300 Subject: fixed styling and removed functions --- Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp index 80408ac..e95fa25 100644 --- a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp +++ b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp @@ -19,7 +19,7 @@ int main() cout << endl; } - // print the first part of the pyramid (the one going from (n-1)...21 to 1 + // print the second part of the pyramid (the one going from (n-1)...21 to 1 for(int i = n - 1; i >= 1; i--) { -- cgit v1.3.1-23-gd82d From 0901d0e587a4fd820d54dac9dca9477dff3b8670 Mon Sep 17 00:00:00 2001 From: Kristian Todorov <63777932+kristian3551@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:07:57 +0300 Subject: fixed styling and spacing of ex 9 --- Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp index e95fa25..d1b339a 100644 --- a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp +++ b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp @@ -11,7 +11,7 @@ int main() for(int i = 1; i <= n; i++) { - for(int k = n - i; k >= 0; k--) + for(int k = n - i - 1; k >= 0; k--) cout << " "; // print the spaces for(int j = i; j >= 1; j--) @@ -23,7 +23,7 @@ int main() for(int i = n - 1; i >= 1; i--) { - for(int k = n - i; k >= 0; k--) + for(int k = n - i - 1; k >= 0; k--) cout << " "; for(int j = i; j >= 1; j--) -- cgit v1.3.1-23-gd82d From 10ddc99b7eb7501b4da3e60d2bf3be0c5c2689a8 Mon Sep 17 00:00:00 2001 From: TihomirGalov Date: Thu, 28 Oct 2021 17:14:25 +0300 Subject: Fixed wrong output on task 2 28 and 21 have only two common dividers which are 7 and 1 in the second case there are missed dividers --- Sem. 03/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index 427d736..af93bf2 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -67,9 +67,9 @@ do **Задача 2:** Да се напише програма, която приема 2 числа. Да се отпечатат всички общи делители сортиран наобратно. -*Вход: 28 21, Изход: 7 3 1* +*Вход: 28 21, Изход: 7 1* -*Вход: 60 30 Изход: 30 15 10 5 3 1* +*Вход: 60 30 Изход: 30 15 10 6 5 3 2 1* *Вход: 5 4 3 0 Изход: 12* -- cgit v1.3.1-23-gd82d From a94b6226e75e809d35bafa7a30bdbf988ed3a052 Mon Sep 17 00:00:00 2001 From: Стоян Златев <47269030+Tony5768@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:18:22 +0300 Subject: Create example 11 - reverse numbers by row --- Sem. 03/example 11 - reverse numbers by row | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Sem. 03/example 11 - reverse numbers by row (limited to 'Sem. 03') diff --git a/Sem. 03/example 11 - reverse numbers by row b/Sem. 03/example 11 - reverse numbers by row new file mode 100644 index 0000000..66a90a9 --- /dev/null +++ b/Sem. 03/example 11 - reverse numbers by row @@ -0,0 +1,28 @@ +#include + +using namespace std; + +int main() +{ + int count; + cin >> count; + + for (int i = 1; i <= count; i++) + { + if (i % 2 != 0) + { + for (int j = 1 + ((i - 1) * count); j <= i * count; j++) + { + cout << j << " "; + } + } + else + { + for (int j = i * count; j > (i - 1) * count; j--) + { + cout << j << " "; + } + } + cout << endl; + } +} -- cgit v1.3.1-23-gd82d From a78a314b374e5372c3865f16bde40845db5b79a2 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:51:13 -0400 Subject: Create exercise 10.cpp --- Sem. 03/solutions/exercise 10.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Sem. 03/solutions/exercise 10.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 10.cpp b/Sem. 03/solutions/exercise 10.cpp new file mode 100644 index 0000000..dae43ab --- /dev/null +++ b/Sem. 03/solutions/exercise 10.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; + +int main() +{ + int count; + cin >> count; + + for (int i = 1; i <= count; i++) + { + for (int j = 0; j < count; j++) + { + if (j % 2 == 0) + { + cout << i + (count * j) << " "; + } + else + { + cout << (j + 1) * count - (i - 1) << " "; + } + } + cout << endl; + } +} -- cgit v1.3.1-23-gd82d From 235bbe2ccc3565f8af02f9cddd76b8937f6dff33 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:51:25 -0400 Subject: Rename exercise 8 - dollar pyramid.cpp to exercise 08 - dollar pyramid.cpp --- Sem. 03/solutions/exercise 08 - dollar pyramid.cpp | 19 +++++++++++++++++++ Sem. 03/solutions/exercise 8 - dollar pyramid.cpp | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 Sem. 03/solutions/exercise 08 - dollar pyramid.cpp delete mode 100644 Sem. 03/solutions/exercise 8 - dollar pyramid.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 08 - dollar pyramid.cpp b/Sem. 03/solutions/exercise 08 - dollar pyramid.cpp new file mode 100644 index 0000000..1ea164d --- /dev/null +++ b/Sem. 03/solutions/exercise 08 - dollar pyramid.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; + +int main() +{ + + int n; + cin >> n; + + for(int i = 1; i <= n; i++) + { + for(int j = 1; j <= i; j++) + cout << "$" << " "; // print as many dollars as the number of the current row + + cout << endl; + } + + return 0; +} diff --git a/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp b/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp deleted file mode 100644 index 65f6106..0000000 --- a/Sem. 03/solutions/exercise 8 - dollar pyramid.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using namespace std; - -int main() -{ - - int n; - cin >> n; - - for(int i = 1; i <= n; i++) - { - for(int j = 1; j <= i; j++) - cout << "$" << " "; // print as many dollars as the number of the current row - - cout << endl; - } - - return 0; -} \ No newline at end of file -- cgit v1.3.1-23-gd82d From 4eb49067c08480fa0b435e6969655e142b71600d Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:51:36 -0400 Subject: Rename exercise 9 - rightmost pyramid.cpp to exercise 09 - rightmost pyramid.cpp --- .../solutions/exercise 09 - rightmost pyramid.cpp | 36 ++++++++++++++++++++++ .../solutions/exercise 9 - rightmost pyramid.cpp | 36 ---------------------- 2 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 Sem. 03/solutions/exercise 09 - rightmost pyramid.cpp delete mode 100644 Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 09 - rightmost pyramid.cpp b/Sem. 03/solutions/exercise 09 - rightmost pyramid.cpp new file mode 100644 index 0000000..573b98b --- /dev/null +++ b/Sem. 03/solutions/exercise 09 - rightmost pyramid.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; + +int main() +{ + + int n; + cin >> n; + + // print the first part of the pyramid (the one going from 1 to n(n-1)...21) + + for(int i = 1; i <= n; i++) + { + for(int k = n - i - 1; k >= 0; k--) + cout << " "; // print the spaces + + for(int j = i; j >= 1; j--) + cout << j; // print numbers j(j - 1)...21 + + cout << endl; + } + // print the second part of the pyramid (the one going from (n-1)...21 to 1 + + for(int i = n - 1; i >= 1; i--) + { + for(int k = n - i - 1; k >= 0; k--) + cout << " "; + + for(int j = i; j >= 1; j--) + cout << j; + + cout << endl; + } + + return 0; +} diff --git a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp b/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp deleted file mode 100644 index d1b339a..0000000 --- a/Sem. 03/solutions/exercise 9 - rightmost pyramid.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -using namespace std; - -int main() -{ - - int n; - cin >> n; - - // print the first part of the pyramid (the one going from 1 to n(n-1)...21) - - for(int i = 1; i <= n; i++) - { - for(int k = n - i - 1; k >= 0; k--) - cout << " "; // print the spaces - - for(int j = i; j >= 1; j--) - cout << j; // print numbers j(j - 1)...21 - - cout << endl; - } - // print the second part of the pyramid (the one going from (n-1)...21 to 1 - - for(int i = n - 1; i >= 1; i--) - { - for(int k = n - i - 1; k >= 0; k--) - cout << " "; - - for(int j = i; j >= 1; j--) - cout << j; - - cout << endl; - } - - return 0; -} \ No newline at end of file -- cgit v1.3.1-23-gd82d From 4e4a0a5458c2e9b015d37956f10fe67f00c05285 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:51:58 -0400 Subject: Delete example 11 - reverse numbers by row --- Sem. 03/example 11 - reverse numbers by row | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 Sem. 03/example 11 - reverse numbers by row (limited to 'Sem. 03') diff --git a/Sem. 03/example 11 - reverse numbers by row b/Sem. 03/example 11 - reverse numbers by row deleted file mode 100644 index 66a90a9..0000000 --- a/Sem. 03/example 11 - reverse numbers by row +++ /dev/null @@ -1,28 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int count; - cin >> count; - - for (int i = 1; i <= count; i++) - { - if (i % 2 != 0) - { - for (int j = 1 + ((i - 1) * count); j <= i * count; j++) - { - cout << j << " "; - } - } - else - { - for (int j = i * count; j > (i - 1) * count; j--) - { - cout << j << " "; - } - } - cout << endl; - } -} -- cgit v1.3.1-23-gd82d From c132894e81e29e4c6c6dfa3a2ea70aea95860955 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:52:11 -0400 Subject: Create exercise 11.cpp --- Sem. 03/solutions/exercise 11.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Sem. 03/solutions/exercise 11.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 11.cpp b/Sem. 03/solutions/exercise 11.cpp new file mode 100644 index 0000000..66a90a9 --- /dev/null +++ b/Sem. 03/solutions/exercise 11.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +int main() +{ + int count; + cin >> count; + + for (int i = 1; i <= count; i++) + { + if (i % 2 != 0) + { + for (int j = 1 + ((i - 1) * count); j <= i * count; j++) + { + cout << j << " "; + } + } + else + { + for (int j = i * count; j > (i - 1) * count; j--) + { + cout << j << " "; + } + } + cout << endl; + } +} -- cgit v1.3.1-23-gd82d From 074da16fc9c98cf99a350939b51ec69c9b201801 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:55:06 -0400 Subject: Delete example 10 - matrix --- Sem. 03/example 10 - matrix | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 Sem. 03/example 10 - matrix (limited to 'Sem. 03') diff --git a/Sem. 03/example 10 - matrix b/Sem. 03/example 10 - matrix deleted file mode 100644 index dae43ab..0000000 --- a/Sem. 03/example 10 - matrix +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int count; - cin >> count; - - for (int i = 1; i <= count; i++) - { - for (int j = 0; j < count; j++) - { - if (j % 2 == 0) - { - cout << i + (count * j) << " "; - } - else - { - cout << (j + 1) * count - (i - 1) << " "; - } - } - cout << endl; - } -} -- cgit v1.3.1-23-gd82d From d9639a5a2b4e3b732738f8021e90d62e34279020 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Fri, 29 Oct 2021 01:14:44 +0300 Subject: Update README.md --- Sem. 03/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index af93bf2..dae7155 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -71,7 +71,7 @@ do *Вход: 60 30 Изход: 30 15 10 6 5 3 2 1* -*Вход: 5 4 3 0 Изход: 12* +*Вход: 19 17 Изход: 1* **Задача 3:** Да се напише програма, която приема число и премахва среднaта цифра , ако числото има нечетен брой цифри или премахва средните две цифри, ако числото има четен брой цифри. След това да се отпечата числото увеличено с 1-ца. -- cgit v1.3.1-23-gd82d From 771f48b96a1db631a04942c0988fdf8f7a364d2b Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 3 Nov 2021 13:25:03 +0200 Subject: Update README.md --- Sem. 03/README.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index dae7155..768614b 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -160,5 +160,7 @@ do +**Задача 15:** Да се напише програма, която приема цяло положително число n и отпечатва следната папионка: +![enter image description here](https://i.ibb.co/FhvpYHP/pap.png) -- cgit v1.3.1-23-gd82d From 7f3e540097425cde3356de7d27e5b47e977ccaa0 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 3 Nov 2021 13:28:45 +0200 Subject: Update drawing_examples.txt --- Sem. 03/drawing_examples.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'Sem. 03') diff --git a/Sem. 03/drawing_examples.txt b/Sem. 03/drawing_examples.txt index d8fad73..d50ae16 100644 --- a/Sem. 03/drawing_examples.txt +++ b/Sem. 03/drawing_examples.txt @@ -120,6 +120,13 @@ $ $ $ $ . . . . . . . . . . . +вход: 5 +. . . . . . . . . . +. . . . +. . . . . . . +. . . . +. . . . . . . . . . + @@ -153,3 +160,30 @@ $ $ $ $ 1 121 1 + +задача 15: + +вход: 3 + +1 1 +1 2 2 1 +1 2 3 --- 3 2 1 +1 2 2 1 +1 1 + +вход: 4 +1 1 +1 2 2 1 +1 2 3 3 2 1 +1 2 3 4 -------- 4 3 2 1 +1 2 3 3 2 1 +1 2 2 1 +1 1 + + +вход: 2 + +1 1 +1 2 – 2 1 +1 1 + -- cgit v1.3.1-23-gd82d From 5f907f416b30533da40965c54463fa3b953b9db4 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 3 Nov 2021 16:15:22 +0200 Subject: Update drawing_examples.txt --- Sem. 03/drawing_examples.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Sem. 03') diff --git a/Sem. 03/drawing_examples.txt b/Sem. 03/drawing_examples.txt index d50ae16..73e3130 100644 --- a/Sem. 03/drawing_examples.txt +++ b/Sem. 03/drawing_examples.txt @@ -172,18 +172,19 @@ $ $ $ $ 1 1 вход: 4 -1 1 -1 2 2 1 -1 2 3 3 2 1 -1 2 3 4 -------- 4 3 2 1 -1 2 3 3 2 1 -1 2 2 1 -1 1 +1 1 +1 2 2 1 +1 2 3 3 2 1 +1 2 3 4 ---- 4 3 2 1 +1 2 3 3 2 1 +1 2 2 1 +1 1 вход: 2 -1 1 -1 2 – 2 1 -1 1 +1 1 +1 2 –- 2 1 +1 1 + -- cgit v1.3.1-23-gd82d From e9b2e3066d218e673eca87959205772cf72b95b4 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 3 Nov 2021 16:16:51 +0200 Subject: Update README.md --- Sem. 03/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sem. 03') diff --git a/Sem. 03/README.md b/Sem. 03/README.md index 768614b..35624d4 100644 --- a/Sem. 03/README.md +++ b/Sem. 03/README.md @@ -161,6 +161,6 @@ do **Задача 15:** Да се напише програма, която приема цяло положително число n и отпечатва следната папионка: -![enter image description here](https://i.ibb.co/FhvpYHP/pap.png) +![enter image description here](https://i.ibb.co/NKSPm4z/ddz.png) -- cgit v1.3.1-23-gd82d From 90d1e842ee65040064207e53bf204d4d9b32d547 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Wed, 3 Nov 2021 18:19:49 +0200 Subject: Create exercise 15.cpp --- Sem. 03/solutions/exercise 15.cpp | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Sem. 03/solutions/exercise 15.cpp (limited to 'Sem. 03') diff --git a/Sem. 03/solutions/exercise 15.cpp b/Sem. 03/solutions/exercise 15.cpp new file mode 100644 index 0000000..652a201 --- /dev/null +++ b/Sem. 03/solutions/exercise 15.cpp @@ -0,0 +1,58 @@ +#include +using namespace std; + +int main() +{ + int n; + cin >> n; + + int spacesCount = 2 * (n - 1) + n + 2 * (n - 1); + int toGuess; + for (int i = 1; i <= n - 1; i++) + { + for (int j = 1; j <= i; j++) + cout << j << " "; + + for (int j = 0; j < spacesCount; j++) + cout << " "; + + for (int j = i; j >= 1; j--) + cout << " " << j; + + spacesCount -= 4; + + cout << endl; + + } + + //mid + for (int i = 1; i <= n; i++) + cout << i << " "; + for (int i = 0; i < n; i++) + cout << '-'; + for (int i = n; i >= 1; i--) + cout << " " << i; + cout << endl; + + + //down + spacesCount += 4; + for (int i = n - 1; i >= 0; i--) + { + for (int j = 1; j <= i; j++) + cout << j << " "; + + for (int j = 0; j < spacesCount; j++) + cout << " "; + + for (int j = i; j >= 1; j--) + cout << " " << j; + + spacesCount += 4; + + cout << endl; + + } + + +} -- cgit v1.3.1-23-gd82d