podvorskij
08.11.2022 13:47

Запишите алгоритм примера на алгоритмическом языке


Запишите алгоритм примера на алгоритмическом языке

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
1FACE1
25.04.2023 23:52
//Microsoft VS 2017 (C++)
//Console application

#include<iostream>

using namespace std;

struct coords {
   double x;
   double y;
};

double findLen ( double x, double y, double x1, double y1) {
             return sqrt(pow(x1 - x, 2) + pow(y1 - y, 2)); //теорема пифагора ( расстояние между двумя точками )
}

double findS( double firstLen, double secLen, double thirdLen) {
        double p = (firstLen + secLen + thirdLen) / 2;
        return sqrt(p * (p - firstLen) * (p - secLen) * (p - thirdLen)); //формула Герона
}

int main() {
        coords A, B, C;
  
        cout << "Input coords for point A : x = ";    cin >> A.x;
        cout << "\t\t\t   y = ";                                   cin >> A.y;
        cout << "Input coords for point B : x = ";    cin >> B.x;
        cout << "\t\t\t   y = ";                                   cin >> B.y;
        cout << "Input coords for point C : x = ";    cin >> C.x;
        cout << "\t\t\t   y = ";                                   cin >> C.y;
        cout << endl << endl; cout << "S for ABC : "<<findS(findLen(A.x,A.y,B.x,B.y), findLen(B.x, B.y, C.x, C.y), findLen(A.x, A.y, C.x, C.y))<<endl;
        system("pause"); //если не компилируется, убери эту строку
        return 0;
}
0,0(0 оценок)
Ответ:
raistarasenko
05.12.2021 04:11

a = input()

mas = []

answer = ""

test01 = "Incorrect"

test02 = "Incorrect"

def check():

   global mas

   global answer

   global test01

   global test02

   

   

   #Bad, but this test01 deleted

   

   

   #Second step for check

   for infinity in range(100):

       for i in range(len(mas)):

           try:

               m = i + 1

               if mas[i] == "[" and mas[m] == "]" or mas[i] == "{" and mas[m] == "}" or mas[i] == "(" and mas[m] == ")":

                   del mas[i]

                   del mas[i]

           except:

               pass

       if len(mas) == 0:

           test02 = "Correct"

           break

       else:

           test02 = "Incorrect"

   #End testing

   if test02 == "Correct":

       answer = "correct"

   else:

       answer = "incorrect"

for i in range(len(a)):

   if a[i] == "{":

       mas.append(a[i])

   if a[i] == "[":

       mas.append(a[i])

   if a[i] == "(":

       mas.append(a[i])

   if a[i] == "}":

       mas.append(a[i])

   if a[i] == "]":

       mas.append(a[i])

   if a[i] == ")":

       mas.append(a[i])

del a

del i

check()

print(answer)

Объяснение:

Благодарности не требую, все ради Вас отметить как лучшее решение

10/10

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота