Введите смещение: 1
Делу время - потехе час | Еёмф гсёна - рпуёцё шбт
С Новым годом | Т Опгьн дпепн
Первое сентября | Рёсгпё тёоуавса
Исходный код на Python3:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
TL2I = dict(zip("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ",range(34)))
I2TL = dict(zip(range(34),"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"))
SL2I = dict(zip("абвгдеёжзийклмнопрстуфхцчшщъыьэюя",range(34)))
I2SL = dict(zip(range(34),"абвгдеёжзийклмнопрстуфхцчшщъыьэюя"))
phrases = ('Делу время - потехе час', 'С Новым годом', 'Первое сентября')
key = int(input("Введите смещение: "))
for phrase in phrases:
ciphered = ''
for c in phrase:
if not c.isalpha():
ciphered += c
if c.islower():
ciphered += I2SL[ (SL2I[c] + key) % 33 ]
if c.isupper():
ciphered += I2TL[ (TL2I[c] + key) % 33 ]
print("{} | {}".format(phrase, ciphered))
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int first = int.Parse(Console.ReadLine());
int second = int.Parse(Console.ReadLine());
if (first == second)
first = second = 0;
else if (first > second)
second = first;
else first = second;
Console.WriteLine("{0} {1}",first,second);
}
}
}
<span>- Общее имя и один тип.</span>
10111011(2) = 1*2^7+0+1*2^5+1*2^4+1*2^3+0+1*2^1+1*2^0 = 128+32+16+8+2+1 = 187(10)