C=A/B
C=26/2
C=13
Просто и легко
Все слова в этом языке имеют вид aba, где a, b - неодинаковые буквы.
На место a можно поставить букву 31 способом, на место b - 30 cпособами (нельзя ставить букву, которая уже стоит на месте a). По правилу умножения получается не более 31 * 30 = 930 комбинаций.
using System;
using System.Collections.Generic;
public class Task
{
public static void Main()
{
//Два вещественных числа на одной строке с любым числом пробелов
Console.WriteLine("Введите коэффициенты a, b:");
var s = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
double a = Convert.ToDouble(s[0]);
double b = Convert.ToDouble(s[1]);
Console.WriteLine("Решения уравнения ({0})*x^3+({1})*x=0:", a, b);
//a*x^3+bx=0
//x(a*x^2+b)=0
//x = 0 или x = +-sqrt(-b/a)
List<double> roots = new List<double>();
roots.Add(0);
const double eps = 1e-7; //точность для сравнения с нулем вещественных чисел
if (Math.Abs(a) < eps)
{
if (Math.Abs(b) < eps)
{
Console.WriteLine("Бесконечное количество решений");
return;
}
}
else
{
double c = -b/a;
if (c > eps)
{
c = Math.Sqrt(c);
roots.Add(-c);
roots.Add(c);
}
}
foreach(var x in roots)
{
Console.Write("{0} ", x);
}
Console.WriteLine();
}
}
Ответ:
Программа на паскале:
const
MAX_N = 20001;
var
a: array[1 ... MAX_N] of integer;
n, i, j, p, maxp: integer;
begin
i : = 1;
read (a[i]) ;
while a[i] 0 do
begin
inc (i) ;
read (a[i]) ;
end;
n : = i - 1;
maxp : = 0;
for i : = 1 to n do
for j : = 1 to n do
begin
p : = a[i] * a[j];
if (p mod 26 = 0) and (p > maxp) then
maxp : = p;
end;
if maxp = 0 then writeln ('Not found')
else writeln (maxp) ;
Объяснение:
<span>// PascalABC.NET 3.3, сборка 1562 от 02.11.2017
</span>
var
a:array[1..1000000] of integer;
i, n, x, y, cnt : integer;
begin
writeln('Введите кол-во элементов массива');
readln(n);
writeln('Введите ', n, ' чисел');
for i:= 1 to n do read(a[i]);
Writeln('Введите промежуток от X до Y');
readln(x, y);
for i:= x to y do
if (a[i] < 0) then cnt:= cnt + 1;
Write('Отрицательных элементов: ', cnt);
end.