Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CountTime(filename: string): integer;
- var
- f1: textfile;
- i, j, a, b, sum, sum_min, n, t: integer;
- begin
- assignfile(f1, FileName);
- reset(f1);
- readln(f1, n);
- readln(f1, t);
- closefile(f1);
- for i := 0 to n do begin
- sum := 0;
- reset(f1);
- for j := 0 to 1 do readln(f1);
- for j := 1 to i do begin
- read(f1, a, b);
- readln(f1);
- sum := sum + a;
- end;
- for j := i + 1 to N do begin
- read(f1, a, b);
- readln(f1);
- sum := sum + b;
- end;
- closefile(f1);
- if (i = 0) or (sum < sum_min) then sum_min := sum;
- end;
- CountTime := sum_min + t;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement