Язык не указан → приведу пример на SWI-Prolog.
Код%Файл string_sortin.plsort([], [], _).sort([Head|Tail], Ordered, Qrd) :- sort(Tail, SubSorted, Qrd), put(Head, SubSorted, Sorted), order(Sorted, [], Ordered, Qrd).put(X, [], [X]).put(X, [H|T], [X,H|T]) :- compare(>, X, H).put(X, [H|T], [H|R]) :- put(X, T, R).order(X, _, X, ">").order([], R, R, "<").order([H|T], B, R, "<") :- order(T, [H|B], R, "<").select(">", Bufer, Bufer, _, ">").select("<", Bufer, Bufer, _, "<").select(S, Bufer, [S|Bufer], Ord, Ord).input_strings(Input, Bufer, Strings, Ord, ROrd) :- compare(=, Ord, "="), read_string(Input, "\n", "\r", _, String), select(String, Bufer, SS, Ord, OO), input_strings(Input, SS, Strings, OO, ROrd).input_strings(_, Strings, Strings, Ord, Ord). ?- current_input(Input), input_strings(Input, [], Strings, "=", Ord), sort(Strings, [R|_], Ord), writeln(R).a = float(input(' 1-го судьи: '))
b = float(input(' 2-го судьи: '))
c = float(input(' 3-го судьи: '))
d = float(input(' 4-го судьи: '))
e = float(input(' 5-го судьи: '))
f = float(input(' 6-го судьи: '))
g = float(input(' 7-го судьи: '))
h = float(input(' 8-го судьи: '))
i = float(input(' 9-го судьи: '))
j = float(input(' 10-го судьи: '))
all_balls = []
all_balls.append(a)
all_balls.append(b)
all_balls.append(c)
all_balls.append(d)
all_balls.append(e)
all_balls.append(f)
all_balls.append(g)
all_balls.append(h)
all_balls.append(i)
all_balls.append(j)
max_ball = max(all_balls)
min_ball = min(all_balls)
ball_sred = (max_ball + min_ball) / 2
print(f'Ваша оценка: {ball_sred}')
Объяснение:
var
x, y, a, b, c, D, x1, x2: real;
inp: string;
inp_arr: array of string;
begin
writeln('a b c');
readln(inp);
inp_arr := inp.split(' ');
a := StrToFloat(inp_arr[0]);
b := StrToFloat(inp_arr[1]);
c := StrToFloat(inp_arr[2]);
D := b*b - 4 * a * c;
x1 := (-b + sqrt(D)) / 2*a;
x2 := (-b - sqrt(D)) / 2*a;
if x1 > x2 then x := x1
else x := x2;
if x < 0 then y:= (1 / (x + (sin(x)/(x*x+1
else y:= (x*x-1)*sin(x)/(x*x*x);
write('a:', a, ' b:', b, ' c:', c, ' x:', x, ' y:', y);
end.