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

Переведите из десятичной в двоичную числа 0,322; 150,7006; 315,075; 181,369;

👇
Ответ:
polinavorkuta
polinavorkuta
10.07.2022
0,322=
150=10010110
7006=1101101011110
315=100111011
075=
181=10110100
369=101110001
4,5(34 оценок)
Открыть все ответы
Ответ:
snsn
snsn
10.07.2022
// PascalABC.Net 3.0, сборка 1052
function kn(a,b,c:integer):byte;
{ функция возвращает количество отрицательных среди a,b,c}
var
  n:byte;
begin
  if a<0 then n:=1 else n:=0;
  if b<0 then Inc(n);
  if c<0 then Inc(n);
  kn:=n
end;

function cond(c:char;v:integer):string;
{ функция формирует строку вида с>0 или c<0 в зависимости от знака v}
begin
  if v<0 then cond:=c+'<0 ' else cond:=c+'>=0'
end;

procedure pv(a,b,c:integer; n:byte);
{ печать строки теста }
var
  m:byte;
begin
  m:=kn(a,b,c);
  Write(cond('a',a),' ',cond('b',b),' ',cond('c',c),' ');
  Write('отрицательных ',m);
  if n=m then Write(' - тест тестовое: ',n);
  Writeln
end;

{ тестовое решение }
const
  T:array[1..8,1..3] of integer=((1,1,1),(1,1,-1),(1,-1,1),
    (1,-1,-1),(-1,1,1),(-1,1,-1),(-1,-1,1),(-1,-1,-1));
  R:array[1..8] of byte=(0,1,1,2,1,2,2,3);
var
  i:byte;
begin
  for i:=1 to 8 do pv(T[i,1],T[i,2],T[i,3],R[i])
end.

Тестирование:
a>=0 b>=0 c>=0 отрицательных 0 - тест
a>=0 b>=0 c<0  отрицательных 1 - тест
a>=0 b<0  c>=0 отрицательных 1 - тест
a>=0 b<0  c<0  отрицательных 2 - тест
a<0  b>=0 c>=0 отрицательных 1 - тест
a<0  b>=0 c<0  отрицательных 2 - тест
a<0  b<0  c>=0 отрицательных 2 - тест
a<0  b<0  c<0  отрицательных 3 - тест
4,4(15 оценок)
Ответ:
rusik20022002
rusik20022002
10.07.2022
/* Язык C++11. Здесь решение вместе с юнит-тестами  */

#include <iostream>
#include <sstream>
#include <string>

int count_negatives(int a, int b, int c)
{
  return (a<0 ? 1:0) + (b<0 ? 1:0) + (c<0 ? 1:0)
}

void solution(std::istream &input = std::cin, std::ostream &output)
{
  int a, b, c;
  input >> a >> b >> c;
  output << count_negatives(a, b, c) << std::endl;
}

void checkTest(std::string input_data, std::string correct_answer)
{
  std::istringstream input(input_data);
  std::istringstream correct_answer_stream(correct_answer);
  std::stringstream algorithm_answer_stream;
  
  int correct_value, algorithm_value;
  correct_answer_stream >> correct_value;
  
  solution(input, algorithm_answer_stream);
  algorithm_answer_stream >> algorithm_value;
  
  if (correct_value != algorithm_value) {
    std::cerr << "Input: " << input_data << std::endl;
    std::cerr << "Correct: " << correct_value << std::endl;
    std::cerr << "Algorithm: " << algorithm_value << std::endl;
    throw std::runtime_error("Test failed");
  }
}

void runTests()
{
  checkTest("1 2 3", "0");
  checkTest("-1 2 3", "1");
  checkTest("1 -2 3", "1");
  checkTest("1 2 -3", "1");
  checkTest("-1 -2 3", "2");
  checkTest("-1 2 -3", "2");
  checkTest("1 -2 -3", "2");
  checkTest("-1 -2 -3", "3");
}

#ifdef __DEBUG
int main(int argc, const char *argv[])
{
  runTests();
  return 0;
}

#else
int main(int argc, const char *argv[])
{
  solution();
  return 0;
}

#endif
4,4(31 оценок)
Это интересно:
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ