Объяснение:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace example
{
class Program
{
static void Main(string[] args)
{
int x, answer1, answer2;
Console.Write("Введите x : ");
x = int.Parse(Console.ReadLine());
answer1 = 2*x+3*Convert.ToInt32(Math.Pow(x,2))-4*Convert.ToInt32(Math.Pow(x,3));
answer2 = 1+2*x+3*Convert.ToInt32(Math.Pow(x,2))+4*Convert.ToInt32(Math.Pow(x,3));
Console.WriteLine("Значение первого выражения : " + answer1);
Console.WriteLine("Значение второго выражения : " + answer2);
Console.ReadLine();
}
}
}
inFile = open('input.txt', 'r', encoding='utf8')
outFile = open('output.txt', 'w', encoding='utf8')
score = []
i = 0
nstr = 1
for line in inFile:
if nstr == 1:
k = int(line)
else:
line1 = line.split()
sc3 = int(line1[-1])
sc2 = int(line1[-2])
sc1 = int(line1[-3])
if sc1 >= 40 and sc2 >= 40 and sc3 >= 40:
score.append(sc1 + sc2 + sc3)
i += 1
nstr += 1
inFile.close()
if k >= i:
print(0, file=outFile)
else:
score.sort(reverse=True)
if score[k-1] > score[k]:
print(score[k-1], file=outFile)
else:
ans = ''
for ii in score[k-1::-1]:
if score[k-1] < ii and ans == '':
ans = ii
if ans == '':
ans = 1
print(ans, file=outFile)
outFile.close()