Skip to content
Merged
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
161 changes: 158 additions & 3 deletions Lab3/Blue.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
namespace Lab3
// namespace Lab3
// {
// public class Blue
// {
// public double Task1(int n, int glass, int norma)
// {
// double milk = 0;

// // code here

// // end

// return milk;
// }
// public (int first, int second, int third, int fourth) Task2(int n)
// {
// int first = 0, second = 0, third = 0, fourth = 0;

// // code here

// // end

// return (first, second, third, fourth);
// }
// public int Task3(int n)
// {
// int count = 0;

// // code here

// // end

// return count;
// }
// public (int tasks, int serias) Task4(int time, int tasks)
// {
// int serias = 0;

// // code here

// // end

// return (tasks, serias);
// }
// public (int power, int agility, int intellect) Task5(int power, int agility, int intellect, int number)
// {

// // code here

// // end

// return (power, agility, intellect);
// }
// }

// }

namespace Lab3
{
public class Blue
{
Expand All @@ -7,17 +64,45 @@ public double Task1(int n, int glass, int norma)
double milk = 0;

// code here

for (int i = 0; i < n; i++)
{
Console.Write($"Введите вес ученика {i + 1}: "); // "Ingrese el peso del alumno"
int weight = int.Parse(Console.ReadLine());

if (weight < norma)
{
milk += glass; // sumar un vaso
}
}

double totalMilkLiters = milk / 1000.0; // convertir a litros
// end

return milk;
return totalMilkLiters;
}
public (int first, int second, int third, int fourth) Task2(int n)
{
int first = 0, second = 0, third = 0, fourth = 0;

// code here
for (int i = 0; i < n; i++)
{
Console.Write($"Введите координаты точки {i + 1} (x y): "); // "Ingrese coordenadas"
string[] input = Console.ReadLine().Split(' ');
int x = int.Parse(input[0]);
int y = int.Parse(input[1]);

if (x > 0 && y > 0)
first++;
else if (x < 0 && y > 0)
second++;
else if (x < 0 && y < 0)
third++;
else if (x > 0 && y < 0)
fourth++;
// Si x == 0 o y == 0 → no cuenta
}
// end

return (first, second, third, fourth);
Expand All @@ -27,7 +112,26 @@ public int Task3(int n)
int count = 0;

// code here
for (int i = 0; i < n; i++)
{
bool hasBadGrade = false; // para marcar si tiene 2 o 3

Console.WriteLine($"Введите 4 оценки студента {i + 1}: "); // "Ingrese 4 notas del estudiante"
for (int j = 0; j < 4; j++)
{
int grade = int.Parse(Console.ReadLine());

if (grade == 2 || grade == 3)
{
hasBadGrade = true; // ya no cuenta este estudiante
}
}

if (!hasBadGrade)
{
count++; // suma solo si NO tenía 2 o 3
}
}
// end

return count;
Expand All @@ -37,6 +141,24 @@ public int Task3(int n)
int serias = 0;

// code here
int taskTime = 10;

while (time < 24 * 60) // hasta las 24:00
{
if (tasks > 0)
{
time += taskTime; // hacer una tarea
taskTime += 5; // la siguiente tarea tarda 5 min más
tasks--;
}
else
{
Console.Write("Введите длительность серии (мин): "); // duración de la serie
int seriasTime = int.Parse(Console.ReadLine());
time += seriasTime; // ver un capítulo
serias++;
}
}

// end

Expand All @@ -46,10 +168,43 @@ public int Task3(int n)
{

// code here
switch (number)
{
case 1:
power += 10;
intellect -= 5; // 1–3 bajan intelecto en 5
break;

case 2:
agility += 5;
power -= 5; // 2 y 5 bajan fuerza en 5
intellect -= 5; // 1–3 bajan intelecto en 5
break;

case 3:
power += 10;
intellect -= 5; // 1–3 bajan intelecto en 5
break;

case 4:
agility += 15;
power -= 10; // 4 baja fuerza e intelecto en 10
intellect -= 10;
break;

case 5:
intellect += 7;
power -= 5; // 2 y 5 bajan fuerza en 5
break;
}

// Clampeo a mínimo 0
power = Math.Max(0, power);
agility = Math.Max(0, agility);
intellect = Math.Max(0, intellect);
// end

return (power, agility, intellect);
}
}
}
}
10 changes: 6 additions & 4 deletions Lab3/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ private static void TestGreen()
// Console.WriteLine($"Task1 test 2. Paste 4 inputs");
// Console.WriteLine($"Task1 test 2 {green.Task1(1, 1, 2, 2) == 2}");
// Console.WriteLine($"Task1 test 3. Paste 10 inputs");
// Console.WriteLine($"Task1 test 3 {green.Task1(1, 1, 2, 5) == 4}");
// Console.WriteLine($"Task1 test 4. Paste 20 inputs");
// Console.WriteLine($"Task1 test 4 {green.Task1(1, 2, 1, 10) == 1}");
// Console.WriteLine($"Task1 test 3 {green.Task1(1, 1, 3, 5) == 4}");
// Console.WriteLine($"Task1 test 4. Paste 10 inputs");
// Console.WriteLine($"Task1 test 4 {green.Task1(1, 1, 2, 5) == 2}");
// Console.WriteLine($"Task1 test 5. Paste 20 inputs");
// Console.WriteLine($"Task1 test 5 {green.Task1(0, 1, 1, 10) == 6}");
// Console.WriteLine($"Task1 test 5 {green.Task1(0, 1, 2, 10) == 7}");

// Console.WriteLine($"Task2 test 1 {green.Task2(0) == (0, 0)}");
// Console.WriteLine($"Task2 test 2. Paste 2 inputs");
Expand Down Expand Up @@ -190,3 +190,5 @@ private static void TestPurple()
}
}
}


Loading