Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 57 additions & 13 deletions Lab1/Green.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Lab1
using System.Xml.Schema;

namespace Lab1
{
public class Green
{
Expand All @@ -7,7 +9,10 @@ public bool Task1(double d)
bool answer = false;

// code here

if (Math.Abs(d) >= 1)
{
answer = true;
}
// end

return answer;
Expand All @@ -17,7 +22,8 @@ public bool Task2(double d, double f)
bool answer = false;

// code here

double arf = (d + f) / 2;
answer = arf > 0;
// end

return answer;
Expand All @@ -27,7 +33,9 @@ public bool Task3(int a, int b)
bool answer = false;

// code here

int sum = a + b;
double am = (Math.Abs(a) + Math.Abs(b)) / 2.0;
answer = sum > am;
// end

return answer;
Expand All @@ -37,7 +45,7 @@ public int Task4(int a, int b, int c)
int answer = 0;

// code here

answer = Math.Max(Math.Max(a, b), c);
// end

return answer;
Expand All @@ -47,7 +55,14 @@ public double Task5(double x)
double answer = 0;

// code here

if (Math.Abs(x) > 1)
{
answer = 0;
}
if (Math.Abs(x) <= 1)
{
answer = x * x - 1;
}
// end

return answer;
Expand All @@ -57,7 +72,19 @@ public bool Task6(double x, double y)
bool answer = false;

// code here

if (y < 0)
{
answer = false;
return answer;
}
if (x < 0)
{
answer = y <= 1 + x;
}
else
{
answer = y <= 1 - x;
}
// end

return answer;
Expand All @@ -68,20 +95,37 @@ public bool Task7(int n)
bool answer = true;

// code here

// end

return answer;
if (n < 0)
{
answer = false;
}
else
{
if (n % 2 == 0)
{
answer = false;
}
}
// end

return answer;
}
public bool Task8(int X, int Y)
{
bool answer = false;

// code here

if (X < 7)
{
return false;
}
int td = (X + 1) / 2;
int ts = td * Y;

answer = ts >= 240;
// end

return answer;
}
}
}
}
63 changes: 54 additions & 9 deletions Lab1/White.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Lab1
namespace Lab1
{
public class White
{
Expand All @@ -7,7 +7,10 @@ public bool Task1(double d)
bool answer = false;

// code here

if (d > 0)
{
answer = true;
}
// end

return answer;
Expand All @@ -17,7 +20,10 @@ public bool Task2(int n)
bool answer = false;

// code here

if (n % 2 == 0)
{
answer = true;
}
// end

return answer;
Expand All @@ -27,7 +33,14 @@ public int Task3(int a, int b)
int answer = 0;

// code here

if (a > b)
{
answer = a;
}
else
{
answer = b;
}
// end

return answer;
Expand All @@ -37,7 +50,14 @@ public double Task4(double d, double f)
double answer = 0;

// code here

if (Math.Abs(d) > Math.Abs(f))
{
answer = f;
}
else
{
answer = d;
}
// end

return answer;
Expand All @@ -47,7 +67,14 @@ public double Task5(double x)
double answer = 0;

// code here

if (Math.Abs(x) > 1)
{
return 1;
}
else
{
return x;
}
// end

return answer;
Expand All @@ -57,7 +84,9 @@ public bool Task6(double x, double y, double r)
bool answer = false;

// code here

double distanceSquared = x * x + y * y;
double difference = Math.Abs(distanceSquared - r * r);
answer = difference <= 0.0001;
// end

return answer;
Expand All @@ -68,7 +97,19 @@ public bool Task7(int n)
bool answer = false;

// code here

int s = n * n;

if (s - n > 2 * n)
{
if (n % 2 == 0)
{
answer = true;
}
else
{
return answer;
}
}
// end

return answer;
Expand All @@ -78,10 +119,14 @@ public bool Task8(double L, int T, int M)
bool answer = false;

// code here
bool timeCondition = (L / 10.0) <= 3.0;
bool landmarksCondition = (T + M) >= 5;
bool mountainsCondition = (M % 2) == 0;

answer = timeCondition && landmarksCondition && mountainsCondition;
// end

return answer;
}
}
}
}
Loading