From 49b6b59cb9f2c038c32ad7e441c07724d6ff5fb6 Mon Sep 17 00:00:00 2001 From: KVKorotkov Date: Thu, 4 Sep 2025 17:10:07 +0300 Subject: [PATCH 1/4] Add files via upload --- Blue.cs | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Blue.cs diff --git a/Blue.cs b/Blue.cs new file mode 100644 index 00000000..4486154d --- /dev/null +++ b/Blue.cs @@ -0,0 +1,95 @@ +namespace Lab1 +{ + public class Blue + { + public bool Task1(int a, int b) + { + bool answer = false; + + // code here + + // end + + return answer; + } + public bool Task2(double d) + { + bool answer = false; + + // code here + Console.WriteLine(d > 0); + + Console.WriteLine(d % 2); + + Console.WriteLine(d % 2 == 0); + // end + + return answer; + } + public bool Task3(int a, int b) + { + bool answer = false; + + // code here + + // end + + return answer; + } + public double Task4(double d, double f, double g) + { + double answer = 0; + + // code here + + // end + + return answer; + } + public double Task5(double x) + { + double answer = 0; + + // code here + + // end + + return answer; + } + public bool Task6(double circleS, double squareS) + { + bool answer = false; + + // code here + // Console.WriteLine(d>0); + + // Console.WriteLine(d % 2); + + // Console.WriteLine(d % 2 == 0); + // end + + return answer; + } + + public double Task7(double d, double f) + { + int answer = 0; + + // code here + + // end + + return answer; + } + public bool Task8(int a, int b, int c) + { + bool answer = false; + + // code here + + // end + + return answer; + } + } +} \ No newline at end of file From 3ac25661c8808b92b5fc459f40c23bccd8c17237 Mon Sep 17 00:00:00 2001 From: KVKorotkov Date: Thu, 4 Sep 2025 17:17:35 +0300 Subject: [PATCH 2/4] Add files via upload --- Lab1/Program.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lab1/Program.cs b/Lab1/Program.cs index 294f141c..ef00c7bc 100644 --- a/Lab1/Program.cs +++ b/Lab1/Program.cs @@ -4,13 +4,14 @@ public class Program { public static void Main() { - //White white = new White(); - //Console.WriteLine(white.Task1(1.2)); - //Console.WriteLine(white.Task2(2)); - //Console.WriteLine(white.Task3(2.5, 1.89)); + Blue blue = new Blue(); + Console.WriteLine(blue.Task1(1, 2)); + Console.WriteLine(blue.Task2(2)); + Console.WriteLine(blue.Task3(2, 1)); //Console.WriteLine(white.Task4(-2.5, 1.89)); //Console.WriteLine(white.Task5(0.5)); //Console.WriteLine(white.Task6(2.5, 1.89, 3)); + Console.WriteLine(blue.Task7(2, 1)); } } } From fcd379c81b3b7717d0af3381bb42ba0dd226b926 Mon Sep 17 00:00:00 2001 From: KVKorotkov Date: Thu, 4 Sep 2025 17:28:22 +0300 Subject: [PATCH 3/4] Delete Blue.cs --- Blue.cs | 95 --------------------------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 Blue.cs diff --git a/Blue.cs b/Blue.cs deleted file mode 100644 index 4486154d..00000000 --- a/Blue.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace Lab1 -{ - public class Blue - { - public bool Task1(int a, int b) - { - bool answer = false; - - // code here - - // end - - return answer; - } - public bool Task2(double d) - { - bool answer = false; - - // code here - Console.WriteLine(d > 0); - - Console.WriteLine(d % 2); - - Console.WriteLine(d % 2 == 0); - // end - - return answer; - } - public bool Task3(int a, int b) - { - bool answer = false; - - // code here - - // end - - return answer; - } - public double Task4(double d, double f, double g) - { - double answer = 0; - - // code here - - // end - - return answer; - } - public double Task5(double x) - { - double answer = 0; - - // code here - - // end - - return answer; - } - public bool Task6(double circleS, double squareS) - { - bool answer = false; - - // code here - // Console.WriteLine(d>0); - - // Console.WriteLine(d % 2); - - // Console.WriteLine(d % 2 == 0); - // end - - return answer; - } - - public double Task7(double d, double f) - { - int answer = 0; - - // code here - - // end - - return answer; - } - public bool Task8(int a, int b, int c) - { - bool answer = false; - - // code here - - // end - - return answer; - } - } -} \ No newline at end of file From 0ee24f8bcf52cbe7f29c2dc37b1643026c76a49c Mon Sep 17 00:00:00 2001 From: KVKorotkov Date: Thu, 2 Oct 2025 17:59:07 +0300 Subject: [PATCH 4/4] Add files via upload --- Lab1/Blue.cs | 68 +++++++++++++++++++++++++++++++++++--------- Lab1/Green.cs | 78 +++++++++++++++++++++++++++++++++++++++++++-------- Lab1/White.cs | 41 ++++++++++++++++++--------- 3 files changed, 147 insertions(+), 40 deletions(-) diff --git a/Lab1/Blue.cs b/Lab1/Blue.cs index 58d9667f..c3de7937 100644 --- a/Lab1/Blue.cs +++ b/Lab1/Blue.cs @@ -7,17 +7,21 @@ public bool Task1(int a, int b) bool answer = false; // code here + // а и б одного знака - проверка, одно из них 0 - фолс + if ((a > 0 && b > 0) || (a < 0 && b < 0)) { answer = true; } + else if (a == 0 || b == 0) { answer = false; } + // end - // end - - return answer; + return answer; } public bool Task2(double d) { bool answer = false; // code here - + int dd = (int)d; + double f = Math.Abs(d - dd); + if( f >= 0.0001) { answer = true; } // end return answer; @@ -27,7 +31,8 @@ public bool Task3(int a, int b) bool answer = false; // code here - + if (b == 0) { answer = false; } + else if (a % b == 0) { answer = true; } // end return answer; @@ -37,10 +42,17 @@ public double Task4(double d, double f, double g) double answer = 0; // code here + double dd = Math.Abs(d); + double ff = Math.Abs(f); + double gg = Math.Abs(g); - // end + if (dd >= ff && dd >= gg) { answer = d; } + else if (ff >= dd && ff >= gg) { answer = f; } + else { answer = g; } - return answer; + // end + + return answer; } public double Task5(double x) { @@ -48,16 +60,23 @@ public double Task5(double x) // code here + if (x <= -1) { answer = 0; } + else if (-1 < x && x <= 0 ) { answer = x + 1; } + else { answer = 1; } + + // end - return answer; + return answer; } public bool Task6(double circleS, double squareS) { bool answer = false; // code here - + double R = Math.Sqrt(circleS / double.Pi); + double side = Math.Sqrt(squareS); + if (2 * R <= side) { answer = true; } // end return answer; @@ -68,17 +87,38 @@ public double Task7(double d, double f) int answer = 0; // code here - - // end - - return answer; + if (Math.Abs(d) < Math.Abs(f)) + { + if (d > 0) { answer = -1; } + } + else + { + if (f > 0) { answer = 1; } + } + // end + + return answer; } public bool Task8(int a, int b, int c) { bool answer = false; // code here - + //1. все ровно без 1oй монеты короля + //sum - общая вместимость + int sum = a + b + c; + int aBig = a / 2; + int bBig = b / 2; + int cBig = c / 2; + + // x - кол-во монет в мешках, x>=1 + //максимум в 3х мешках по x монет -- x<=aBig;bBig;cBig + // кол-во всего монет - 3x + 1( 1 - та монета, которую от себя король может добавить + //проверка на то что в мешке не 0 морнет + //надо: 1. x>=1, 2. x<=aBig;bBig;cBig, 3. sum >= 2x(если монеты 2, то может добавить король) + //1 монета == false + // влияет ли вместимость мешка младшего ребенка на кол-во монет у других?.. + // end return answer; diff --git a/Lab1/Green.cs b/Lab1/Green.cs index 52d0220a..8a406834 100644 --- a/Lab1/Green.cs +++ b/Lab1/Green.cs @@ -7,7 +7,10 @@ public bool Task1(double d) bool answer = false; // code here - + if (Math.Abs(d) >= 1) + { + answer = true; + } // end return answer; @@ -17,7 +20,8 @@ public bool Task2(double d, double f) bool answer = false; // code here - + double c = (d + f) / 2; + if (c > 0) { answer = true; } // end return answer; @@ -27,7 +31,11 @@ public bool Task3(int a, int b) bool answer = false; // code here - + int A = Math.Abs(a); + int B = Math.Abs(b); + int AB = (A + B) / 2; + int sum = a + b; + if (sum > AB) { answer = true; } // end return answer; @@ -37,7 +45,8 @@ public int Task4(int a, int b, int c) int answer = 0; // code here - + int v = Math.Max(Math.Max(a, b), c); + answer = v; // end return answer; @@ -47,20 +56,23 @@ public double Task5(double x) double answer = 0; // code here + if (Math.Abs(x) > 1) { answer = 0; } + else if (Math.Abs(x) <= 1) { answer = x * x - 1; } + // end - // end - - return answer; + return answer; } public bool Task6(double x, double y) { bool answer = false; // code here + if (y < 0) { answer = false; } + else if ((x < 0) && (y <= 1 + x)) { answer = true; } + else if ( (x >= 0) && (y <= 1 - x) ) { answer = true; } + // end - // end - - return answer; + return answer; } public bool Task7(int n) @@ -68,7 +80,9 @@ public bool Task7(int n) bool answer = true; // code here - + if (n < 0) { answer = false; } + else if (n % 2 == 0) { answer = false; } + // end return answer; @@ -78,7 +92,47 @@ public bool Task8(int X, int Y) bool answer = false; // code here - + //встает на данный момент в 14 часов дня + int getup = 14; + //на данный момент ложится в 4 часа ночи ( в минутах) + int startsleep = 4 * 60; + + //каждое утро дыхательные практики смещают время подъёма на -1 час + //дни в когда пьет чай - 0,2,4,... (через день), засыпает наа Y минут раньше + //итоговое время подъема после X дней + int resultgetup = getup - X; + if (resultgetup < 0) { resultgetup = 0; } + //раньше полуночи не вставать + + //кол-во дней когда пила чай (примерно (X+1)/2 или X/2(если четное Х), но лучше Х+1) + int dayswithtea = (X + 1) / 2; + //смещение времени сна в минутах + int changesleep = dayswithtea * Y; + int result = startsleep - changesleep; + if (result < 0) { result = 0; } + //раньше полуночи не ложится + //проверить длительность сна + //посчитать разницу в минутах между подъемом и сном + //время пробуждения в минуты переведуц + int resulttime = resultgetup * 60; + //если время подъема больше времени сна, считаю разницу + int sleepduration = resulttime - result; + if (sleepduration < 0) { sleepduration += 24 * 60; } + //если перескочили через полуночь + + //проверка сна маши (7*60=420, 9*60=540) + bool sleep = false; + bool wakeup = false; + if ((sleepduration >= 7 * 60) && (sleepduration <= 9 * 60)) { sleep = true; } + //if (resultgetup <= 7) { wakeup = true; } + //bool sleepOk = sleepduration >= 420 && sleepduration <= 540; + // Встает ли Маша не позже 7 утра? + //bool wakeUpOk = resultgetup <= 7; + + if (sleep /*&& wakeup*/) + { + answer = true; + } // end return answer; diff --git a/Lab1/White.cs b/Lab1/White.cs index 29fe881b..5e46fe2f 100644 --- a/Lab1/White.cs +++ b/Lab1/White.cs @@ -1,4 +1,6 @@ -namespace Lab1 +using System.ComponentModel.Design; + +namespace Lab1 { public class White { @@ -7,27 +9,30 @@ public bool Task1(double d) bool answer = false; // code here - + if (d > 0) { answer = true; } // end - return answer; + return answer; } public bool Task2(int n) { bool answer = false; // code here + if ((n % 2) == 0) { answer = true;}// если н четно - тру + else { answer = false; } // в противном случае - фолс ( надо ли перед ансвер бул ставить? // end - return answer; + return answer; } public int Task3(int a, int b) { int answer = 0; // code here - + if (a >= b) { answer = a; } + else { answer = b; } // end return answer; @@ -37,7 +42,8 @@ public double Task4(double d, double f) double answer = 0; // code here - + if ((d * d) > (f * f)) { answer = d; } + else { answer = f; } // end return answer; @@ -47,7 +53,8 @@ public double Task5(double x) double answer = 0; // code here - + if (Math.Abs(x) > 1 ) { answer = 1; } + else { answer = x; } // end return answer; @@ -57,7 +64,7 @@ public bool Task6(double x, double y, double r) bool answer = false; // code here - + if (Math.Abs(x * x + y * y - r * r) <= (1.0 / 10000)) { answer = true; } // end return answer; @@ -66,19 +73,25 @@ public bool Task6(double x, double y, double r) public bool Task7(int n) { bool answer = false; - // code here - - // end - - return answer; + int s = n * n; + if ((s-n) > (2*n)) + { + if (n%2 == 0) { answer = true; } + } + // end + + return answer; } public bool Task8(double L, int T, int M) { bool answer = false; // code here - + if (L <= 30 && (T + M) >= 5 && M % 2 == 0) + { + answer = true; + } // end return answer;