using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KekTus
{
class Program
{
static void PrintArr(int[][] arr)
{
foreach (var str in arr)
{
foreach (var el in str)
Console.Write($"{el}\t");
Console.WriteLine();
}
}
static void Main(string[] args)
{
int M;
int N;
try
{
Console.Write("M = "); M = int.Parse(Console.ReadLine());
Console.Write("N = "); N = int.Parse(Console.ReadLine());
}
catch
{
Console.WriteLine("Ошибка ввода");
return;
}
if (N < 0 || M < 0)
{
Console.WriteLine("Ошбка ввода");
return;
}
Console.WriteLine("M = {0}; N = {1}.", M, N);
int[][] Arr = new int[M][];
var rand = new Random();
for(int i = 0; i < M; ++i)
{
Arr[i] = new int[N];
for (int j = 0; j < N; ++j)
Arr[i][j] = rand.Next(10,99);
}
Console.WriteLine("Исходный массив:");
PrintArr(Arr);
Console.WriteLine();
int[][] Buffer = new int[N][];
for (int j = 0; j < N; ++j)
Buffer[j] = new int[M];
for (int i = 0; i < M; ++i)
for (int j = 0; j < N; ++j)
Buffer[j][i] = Arr[i][j];
Arr = Buffer;
Console.WriteLine("Преобразованный :");
PrintArr(Arr);
Console.WriteLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KekTus
{
class Program
{
static void PrintArr(int[][] arr)
{
foreach (var str in arr)
{
foreach (var el in str)
Console.Write($"{el}\t");
Console.WriteLine();
}
}
static void Main(string[] args)
{
int M;
int N;
try
{
Console.Write("M = "); M = int.Parse(Console.ReadLine());
Console.Write("N = "); N = int.Parse(Console.ReadLine());
}
catch
{
Console.WriteLine("Ошибка ввода");
return;
}
if (N < 0 || M < 0)
{
Console.WriteLine("Ошбка ввода");
return;
}
Console.WriteLine("M = {0}; N = {1}.", M, N);
int[][] Arr = new int[M][];
var rand = new Random();
for(int i = 0; i < M; ++i)
{
Arr[i] = new int[N];
for (int j = 0; j < N; ++j)
Arr[i][j] = rand.Next(10,99);
}
Console.WriteLine("Исходный массив:");
PrintArr(Arr);
Console.WriteLine();
int[][] Buffer = new int[N][];
for (int j = 0; j < N; ++j)
Buffer[j] = new int[M];
for (int i = 0; i < M; ++i)
for (int j = 0; j < N; ++j)
Buffer[j][i] = Arr[i][j];
Arr = Buffer;
Console.WriteLine("Преобразованный:");
PrintArr(Arr);
Console.WriteLine();
}
}
}
Объяснение:
var
s:array[1..10000] of longint;
a,b,i,k,max:longint;
begin
read(a);
for i:=1 to a do
begin
read(s[i]);
end;
max:=s[1];
for i:=1 to a do
if (s[i] mod 2 = 1) and (s[i] mod 10000 <> 6) and (s[i] div 10 mod 1000 <> 6) and (s[i] div 100 mod 100 <>0) and (s[i] div 1000 mod 10) and (s[i] div 10000 <>6) then
begin
max:=s[i];
inc(k);
end;
end;
if (k=0) then write(0) else write(max);
end.