|A| = 10 - число символов в алфавите
N = 10^1 - число различных вариантов
I = Log2 10 = 3,32 бит
Ответ: 4 бита
C#
int N = Convert.toInt32(Console.ReadLine());
int sum = 0;
for (int n = 0; n < N; n++)
{
int a = Convert.toInt32(Console.ReadLine());
if (a < 15)
{
sum = sum + a;
}
}
if (sum > 60)
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
Console.ReadKey();
Def animals(y):
return "Животное года - " + {
0 : "крыса",
1 : "бык",
2 : "тигр",
3 : "кролик",
4 : "дракон",
5 : "змея",
6 : "лошадь",
7 : "коза",
8 : "обезьяна",
9 : "петух",
10 : "собака",
11 : "свинья",
}.get(y)
n = int(input("Введите год: "))
print (animals((n-4) % 12))
Пример:
<span>Введите год: 2017
Животное года - петух</span>
Using System;
using System.Linq;
using System.Numerics;
class Program
{
public static readonly char[] hex_chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
static void Main()
{
var random = new Random(DateTime.Now.Millisecond);
var long_hex = new char[random.Next(10, 255)];
for (var i = 0; i < long_hex.Length; i++)
{
long_hex[i] = hex_chars[random.Next(0, 15)];
Console.Write(long_hex[i] + " ");
}
Console.WriteLine();
LongHexToNumber(long_hex);
Console.ReadKey();
}
static void LongHexToNumber(char[] long_hex)
{
var s = long_hex.Aggregate("", (xs, x) => x + xs);
var number = BigInteger.Parse(s, System.Globalization.NumberStyles.AllowHexSpecifier);
Console.WriteLine("Число = {0}", number);
Console.WriteLine("Число(HEX) = {0:X}", number);
Console.WriteLine("Входит в диапазон int: {0}", int.MaxValue >= number && int.MinValue <= number);
Console.WriteLine("Входит в диапазон uint: {0}", uint.MaxValue >= number && uint.MinValue <= number);
Console.WriteLine("Входит в диапазон long: {0}", long.MaxValue >= number && long.MinValue <= number);
Console.WriteLine("Входит в диапазон ulong: {0}", ulong.MaxValue >= number && ulong.MinValue <= number);
}
}
Только еще надо подключить библиотеку System.Numerics.dll
Для этого надо в проекте найти Reference, правой кнопкой -> Add Reference (откроется окошко) и там в стандартных библиотеках найти нужную