Пусть x - количество плацкартных вагонов.
Вероятность того, что выбора плацкартного вагона p = x/28
I = log(2)[1/p]
log(2)[1 / (x/28)] = 2 ⇒ 28/x = 4 ⇒ x = 7
Ответ: в поезде 7 плацкартных вагонов
Найдем вес 1 символа (i). Он выбирается из 25 букв и 10 цифр, т.е. N=25+10=35
N= 2^i,
35=2^i, отсюда i=6 бит
1 номер состоит из 7 символов, вес 1 номера=7*6=42 бита=6 минимально возможных байт.
80 номеров=80*6=480 байт
#include <iostream> // header input/output streams
#include <fstream> // header для работы с файлами
using std::ifstream; // для работы с файлом input.txt
using std::ofstream; // для работы с файлом output.txt
using std::cin; // для работы cin
using std::cout; // для работы cout
using std::endl; // для работы перевода на новую строку endl
int main(){
ifstream in_file;
ofstream out_file;
try{
in_file.open("input.txt");
out_file.open("output.txt");
}
catch(std::exception& e){
cout << e.what() << endl;
}
unsigned int a,b;
in_file >> a >> b;
unsigned int sum = a+b -1;
cout << sum;
out_file << sum - a << ' ' << sum-b << endl;
}
A = int(input())
if 2 <= a <= 5:
a += 10
elif 7 <= a <= 40:
a -= 100
elif a <= 0 or a > 3000:
a *= 3
else:
a = 0
print(a)