М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
VasyaPupkin001
VasyaPupkin001
24.02.2023 14:00 •  Информатика

Выбери правильный ответ в информатике


Выбери правильный ответ в информатике

👇
Открыть все ответы
Ответ:
ИноК11
ИноК11
24.02.2023

#include <iostream>

#include <vector>

#include <cstdint>

using namespace std;  template <class T>

istream& operator>>(istream &in, vector<T> &vec) {   for (auto &it : vec)     in >> it;   return in;

}  

template <class T>

ostream& operator<<(ostream &out, vector<T> &vec) {   for (auto &it : vec)     out << it << ' ';   return out;

}  

template <class T, class U>

istream& operator>>(istream &in, pair<T, U> &pair) {   in >> pair.first >> pair.second;   return in;

}  

template <class T, class U>

ostream& operator<<(ostream &out, pair<T, U> &pair) {   out << pair.first << ' ' << pair.second;   return out;

}

signed main(void) {     int32_t n; cin >> n;     vector<vector<int64_t>> a(n, vector<int64_t>(n,-1));     int64_t x = 0, y = n/2;     a[x][y] = 1;     for(int32_t i = 2; i <= n*n; ++i) {         int _x = x, _y = y;         if(!x) {             x =  n-1;         }         else {             --x;         }         if(y == n-1) {             y = 0;         }         else {             ++y;         }         if(a[x][y] != -1) {             x= _x, y = _y;             while(a[x][y] != -1) {                 if(x == n-1) {                     x = 0;                 }                 else {                     ++x;                 }             }         }         a[x][y] = i;     }     for(int32_t i = 0; i < n; ++i) {         cout << a[i] << '\n';     }     return 0;  }

Объяснение:

Запишем на C++ то, что написано в условии.

Если надо, то код также прикрепил в виде файла

Списывать не хорошо)

Если повезёт увидемся в (СИРИУС)

4,4(27 оценок)
Ответ:
RengevychPolina
RengevychPolina
24.02.2023
Program project1;
uses
crt,math;
var  s:real;  i,j,f:real;  a:integer;
begin 
writeln('vvedite 1 chislo ');readln(i);
  writeln('vvedite 2 chislo ');readln(j); 
 writeln('vvedite 3 chislo ');readln(f); 
 s:=i; 
 if j<s then s:=j; 
 if f<s then s:=f; 
 if s<0 then 
 begin  
  if i<0 then inc(a);  
  if j<0 then inc(a);  
  if f<0 then inc(a);  
  writeln('kolichestvo otricatelnix ',a:2);
  end 
 else  
begin  
  if i>0 then i:=i*-1;
  if j>0 then j:=i*-1;
  if f>0 then f:=i*-1; 
 end; 
 writeln('min chislo ',s:2:0); 
 readln;
end.     
4,8(53 оценок)
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ