dolgikof
25.12.2022 18:43

1. Ниже приведена программа:

var s,k: integer;
begin
readln(s);
readln(t);
if (s < 1) and (t < 2)
then
writeln ('YES')
else
writeln ('NO')
end.
Было выведено 9 запусков программы, при которых в качестве значений переменных вводились следующие пары чисел (s, t):

(3, 5); (4, 3); (4, −5); (0, 7); (0, −2); (−2, 1); (−2, 5); (−2, −4); (1, 2).

Сколько было запусков, при которых программа напечатала «NO»? В качестве решения выпишите все пары запусков и напротив каждого укажите вывод: YES или NO. В ответе укажите количество.

2. Составьте программу, выводящую значение вещественной переменной x, равной значению выражения 2(a+b)/a^2,где a и b – целочисленные переменные, их значения вводятся с клавиатуры.

3. Целое положительное число вводится с клавиатуры. Нужно проверить является ли оно четным.

4. Напишите программу, которая вычисляет сумму n-первых целых положительных чисел S = 1 + 2 + 3 + … + n. Количество суммируемых чисел n должно вводиться пользователем во время работы программы.​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
tomas787
23.02.2021 07:50

1) #include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  string a,b;

  cin >> a >> b;

  if(tolower(a[0]) == tolower(b[b.length()-1]))

      cout << "YES";

      cout << "NO"

2)

#include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  string a,b;

  string s = "tros";

  reverse(s.begin(),s.end());

  cout << s << "\n";

  for(int i = s.length()-1; i >= 0; i -= 2)

      cout << s[i];

  for(int i = s.length()-2; i >= 0; i -= 2)

      cout << s[i];

  cout << "\n";

 cout << s[2] << s[1] << s[0] << s[3];

3)

#include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

  ios_base::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  string s;

  set<int> st;

  for(int i = 0; i < 10; i++)

     st.insert(i);

 getline(cin,s);

 for(

   if(st.find(int(i)-48) != st.end())

          cout << "YES";

          return 0;

  cout << "NO";

0,0(0 оценок)
Ответ:
креореглеонл
23.02.2021 07:50

1) #include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

   ios_base::sync_with_stdio(0);

   cin.tie(0);

   cout.tie(0);

   string a,b;

   cin >> a >> b;

   if(tolower(a[0]) == tolower(b[b.length()-1]))

       cout << "YES";

   else

       cout << "NO";

}

2)

#include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

   ios_base::sync_with_stdio(0);

   cin.tie(0);

   cout.tie(0);

   string a,b;

   string s = "tros";

   reverse(s.begin(),s.end());

   cout << s << "\n";

   for(int i = s.length()-1; i >= 0; i -= 2)

       cout << s[i];

   for(int i = s.length()-2; i >= 0; i -= 2)

       cout << s[i];

   cout << "\n";

   cout << s[2] << s[1] << s[0] << s[3];

}

3)

#include <iostream>

#include <set>

#include <vector>

using namespace std;

signed main() {

   ios_base::sync_with_stdio(0);

   cin.tie(0);

   cout.tie(0);

   string s;

   set<int> st;

   for(int i = 0; i < 10; i++)

       st.insert(i);

   getline(cin,s);

   for(auto i: s)

   {

       if(st.find(int(i)-48) != st.end())

       {

           cout << "YES";

           return 0;

       }

   }

   cout << "NO";

}

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