Created
August 24, 2022 22:28
-
-
Save Zerumi/8fdf2280160b2bb78eafd7540417ba8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ege22new | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int N = 12; // total ids | |
int[] time = new int[] { 4, 3, 1, 7, 6, 3, 1, 2, 7, 8, 6, 6 }; | |
List<int[]> dependensens = new() | |
{ | |
new int[] {0}, | |
new int[] {0}, | |
new int[] {1,2}, | |
new int[] {3}, | |
new int[] {3}, | |
new int[] {5}, | |
new int[] {4,6}, | |
new int[] {7}, | |
new int[] {0}, | |
new int[] {0}, | |
new int[] {9}, | |
new int[] {10}, | |
}; | |
for (int i = 0; i < N; i++) | |
{ | |
int totaltime = time[i]; | |
if (dependensens[i][0] == 0) | |
{ | |
continue; | |
} | |
int maxdeptime = 0; | |
foreach (var depproc in dependensens[i]) | |
{ | |
maxdeptime = Math.Max(time[depproc - 1], maxdeptime); | |
} | |
totaltime += maxdeptime; | |
time[i] = totaltime; | |
} | |
foreach (var item in time) | |
{ | |
Console.WriteLine(item); | |
} | |
Console.WriteLine(time.Max()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Решение Демо варианта новой задачи 22 на ЕГЭ по информатике 2023