IPB
ЛогинПароль:

> Прочтите прежде чем задавать вопрос!

1. Заголовок темы должен быть информативным. В противном случае тема удаляется ...
2. Все тексты программ должны помещаться в теги [code=pas] ... [/code], либо быть опубликованы на нашем PasteBin в режиме вечного хранения.
3. Прежде чем задавать вопрос, см. "FAQ", если там не нашли ответа, воспользуйтесь ПОИСКОМ, возможно такую задачу уже решали!
4. Не предлагайте свои решения на других языках, кроме Паскаля (исключение - только с согласия модератора).
5. НЕ используйте форум для личного общения, все что не относится к обсуждению темы - на PM!
6. Одна тема - один вопрос (задача)
7. Проверяйте программы перед тем, как разместить их на форуме!!!
8. Спрашивайте и отвечайте четко и по существу!!!

> Паралельная форма!, Построить паралельную форму на основе матрицы
сообщение
Сообщение #1


Пионер
**

Группа: Пользователи
Сообщений: 55
Пол: Мужской

Репутация: -  -1  +


Люди обьяснтете пожалуста такую ситуацию!!!
Нужно в Паскале построить (написать програмку) паралельную форму на основе матрицы, т.е. У нас есть одна матрица 5x7, В етой матрице выполняются операции умножения,сложения,умножение+сложение!!!!!
нужно все ети операции занести в паралельную форму (паралельная форма - это табличка 4X8)таким образом что бы в каждой ячейке выполнялась одна операция!!!
Помогите пожалуста и подскажите с чего б его начать????
Я прикреплю саму скриншот матрицы 5X7!!! И скриншот самой паралельной формы которую я зделал в ворде.


Эскизы прикрепленных изображений
Прикрепленное изображение Прикрепленное изображение
 Оффлайн  Профиль  PM 
 К началу страницы 
+ Ответить 
 
 Ответить  Открыть новую тему 
Ответов
сообщение
Сообщение #2


Пионер
**

Группа: Пользователи
Сообщений: 55
Пол: Мужской

Репутация: -  -1  +


Нашол в инете одну прогу!!! Но немогу понять какие под нее матрицы надо, с какими елементами?????

program matr; type
Matrix = array[1..8,1..8] of integer;
Algorithm = array[1..8,1..8] of integer;
var A:Matrix;
B:Matrix;
C:Matrix;
M, N, K: integer;
H, W: integer;
Results:Text;
MatrA: Text;
MatrB: Text;
MatrC: Text;
Alg: Algorithm;

procedure ReadMatrix(var Matr:Matrix;i,j,rows,columns:integer; var F: Text);
var
k,l:integer;
begin
{Schitat iz faila F elementy matritsy v peremennuju Matr}
for k:=i to rows do
begin
for l:=j to columns do
begin
Read (F,Matr[k][l]);
end;
end;
end;




procedure PrintMatrix(var Matr:Algorithm;i,j,rows,columns:integer;var F:Text); var
k,l:integer; begin
{Kazhdyj element matritsy Matr vyvesti na ekran2}
for k:=i to rows do
begin
for l:=j to columns do begin
Write (F,Matr[k][l], ' '); end;
WriteLn(F);end;end;



procedure InitZeros(var Matr: Matrix; i, j, rows, columns: integer); var
k,l:integer; begin
{Kazhdomu elementu matritsy Matr prisvoit 0}
for k:=i to rows do
begin
for l:=j to columns do begin
Matr[k][l]:=0; end; end; end;


function FindNextNonZero(Var Matr:Matrix; var startx,starty,rows,columns:integer):boolean;
var l:integer;
begin
l:= starty;
{Prosmatrivaem vse elementy v massive рока ne najdem ne 0-j}
while ((Matr[startx][l] = 0) and (startx <= rows)) do
begin
while ((Matr[startx][l] = 0) and (l <= columns)) do
begin
l:=l+ 1;
end;
if Matr[startx][l] = 0 then begin
startx := startx + 1; l:=1; end; end;
starty := 1;
FindNextNonZero := (Matr[startx] [l]<>0); end;



procedure FindNextEmpty(startx:integer; var x, y: integer);
var
l:integer;
begin
l:=1;
{Prosmatrivaem vse elementy v massive рока ne najdem pustuju stroku}
while (Length(Alg[startx][l]) <> 0) do
begin
if l=8 then
begin startx := startx + 1; l:=1;
end
else
begin
l:=l + 1;
end; end;
x := startx; y:=l;
end;

function intToStr(I: Longint): String;
{ Convert any integer type to a string } var
S:string [32];
begin
Str(I, S);
IntToStr:= S;
end;

procedure ParseElement(i, j: integer);
var l, v: integer;
x_alg, y_alg: integer;
begin l:=1;
while (I <= K) and ((A[i][l] = 0) or (B[l][j] = 0)) do
begin
l:=l+1; end;
if (A[i][l] <> 0) and (B[l][j] <> 0) then begin
FindNextEmpty (1, x_alg, y_alg);
Alg[x_alg][y_alg] := 'A' + IntToStr(i) + IntToStr(l) + '*B'+IntToStr(l)+IntToStr(j);
H := x_alg;
W := y_alg; end;
v:=l+1;
while (v <= K) and ((A[i][v] = 0) or (B[v][j] = 0)) do
begin
v:=v+1; end;

if (A[i][v] <> 0) and (B[v][j] <> 0) then
begin
FindNextEmpty (1, x_alg, y_alg);

Alg[x_alg][y_alg] := 'A' + IntToStr(i) + IntToStr(v) + '*B'+IntToStr(v)+intToStr(j);
FindNextEmpty (x_alg+l, x_alg, y_alg);
Alg[x_alg][y_alg] := 'A' + IntToStr(i) + IntToStr(l) + '*B'+IntToStr(l)+IntToStr(j)
+'+'+'A' + IntToStr(i) + IntToStr(v) + '*B'+IntToStr(v)+intToStr(j);

H := x_alg;
W := y_alg; end;
end;

procedure MakeAlg; var

i, j : integer;
g, f: integer;
begin i:=1; j:=1;
for g:= 1 to 8 do
for f:= 1 to 8 do
Alg[g][f]:=' ';
while (FindNextNonZero(C, i, j, M, K)) do
begin
ParseElement(i, j);
if j = k then
begin
j:=i;
i:=i+1; end else
end; end;
begin
{Otkryt faily dlia chtenia ishodnyh matrits i dlia zapisi reultatov}
Assign(Results, 'results4.txt');
Rewrite(Results);
Assign(MatrA, 'A.txt');
Assign(MatrB, 'B.txt');
Assign(MatrC, 'C1.txt');
reset(MatrA);
Reset(MatrB);
Reset(MatrC);
{Razmer matrits}
M:=5;N:=6; K:=7;
{Schitat matritsy A,B i C}
ReadMatrix(A, 1,1, M, N, MatrA);
ReadMatrix(B, 1,1, N, K, MatrB);
ReadMatrix(C, 1,1, M, K, MatrC);
{Opredeliaem algoritm MakeAlg;}
{Vyvodim algoritm}
WriteLn (Results);
WriteLn (Results, 'Algorithm CO:');
PrintMatrix(Alg, 1,1,2, 8, Results);

WriteLn (Results);
WriteLn (Results, 'Xarakteristiki algoritma:');
WriteLn (Results);
WriteLn (Results, 'Sp = ', (8*(H-1) + W) / H);
WriteLn (Results);
WriteLn (Results, 'Ep = ', (8*(H-1) + W) / H / 8);
WriteLn (Results); WriteLn (Results, 'h = ', H);
WriteLn (Results);
WriteLn (Results, 'Z = ', (8*(H-1) + W) / (8*H) *100, '%');
{Zakryt faily} Close(MatrC); Close(MatrB); Close(MatrA);
Assign(MatrA, 'matr_al.txt'); Assign(MatrB, 'matrJM.txt'); Assign(MatrC, 'matr_cl.txt');
Reset(MatrA); Reset(MatrB); Reset(MatrC);
{Razmer matrits} M:=4;
N := 5; K:=4;
{Schitat matritsy A,B i C} InitZeros(A, 1,1, 8, 8); initZeros(B, 1,1, 8, 8);
InitZeros(C, 1, 1, 8, 8); ReadMatrix(A, 1,1, M, N, MatrA);
ReadMatrix(B, 1,1, N, K, MatrB); ReadMatrix(C, 1, 1, M, K, MatrC);
{Opredeliaem algoritm} MakeAlg;
{Vyvodim algoritm}
WriteLn (Results);
WriteLn (Results, 'Algorithm CI:');
PrintMatrix(Alg, 1,1, 4, 8, Results);
WriteLn (Results);
WriteLn (Results, 'Xarakteristiki algoritma:');
WriteLn (Results);


writeln (Results, 'Sp = ', (8*(H-1) + W) / H);
WriteLn (Results);

WriteLn (Results, 'Ep = ', (8*(H-1) + W) / H / 8);
WriteLn (Results); WriteLn (Results, 'h = ', H);
WriteLn (Results);
WriteLn (Results, 'Z = ', (8*(H-1) + W) / (8*H) *100,'%');
{Zakryt faily} Close(MatrC); Close(MatrB); Close(MatrA);
Assign(MatrA, 'matr_a2.txt'); Assign(MatrB, 'matrjbj.txt'); Assign(MatrC, 'matr_c2.txt');
Reset(MatrA); Reset(MatrB); Reset(MatrC);
{Razmer matrits} M:=2;
N :=5; K:=4;
InitZeros(A, 1, 1, 8, 8); InitZeros(B, 1,1, 8, 8); InitZeros(C, 1,1, 8, 8);
{Schitat matritsy A,B i C}
ReadMatrix(A, 1, 1, M, N, MatrA);
ReadMatrix(B, 1,1, N, K, MatrB);
ReadMatrix(C, 1, 1, M, K, MatrC);
{Opredeliaem algoritm} MakeAlg;
{Vyvodim algoritm}
WriteLn (Results);
WriteLn (Results, 'Algorithm C2:');
PrintMatrix(Alg, 1, 1,1, 8, Results);
WriteLn (Results);
WriteLn (Results, 'Xarakteristiki algoritma:');
WriteLn (Results);
WriteLn (Results, 'Sp = ', (8*(H-1) + W) / H);
WriteLn (Results);
WriteLn (Results, 'Ep = ', (8*(H-1) + W) / H / 8);

WriteLn (Results); WriteLn (Results, 'h = ', H);
WriteLn (Results);
WriteLn (Results, 'Z = ', (8*(H-1) + W) / (8*H) *100,'%');
{Zakryt faily} Close(MatrC); Close(MatrB); Close(MatrA);
Assign(MatrA, 'matr_a2.txt'); Assign(MatrB, 'matr_b0.txt'); Assign(MatrC, 'matr_c3.txt');
Reset(MatrA); Reset(MatrB); Reset(MatrC);
{Razmer matrits}
M:=2; N := 5; K:=2;
InitZeros(A, 1, 1, 8,8); InitZeros(B, 1,1, 8, 8); InitZeros(C, 1,1, 8, 8);
{Schitat matritsy A,B i Q ReadMatrix(A, 1, 1, M, N, MatrA);
ReadMatrix(B, 1,1, N, K, MatrB); ReadMatrix(C, 1,1, M, K, MatrC);
{Opredeliaem algoritm} MakeAlg;
{Vyvodim algoritm}
WriteLn (Results);
WriteLn (Results, 'Algorithm C3:');
PrintMatrix(Alg, 1, 1,1, 8, Results);
WriteLn (Results);
WriteLn (Results, 'Xaraktenstiki algoritma:');
WriteLn (Results);
WriteLn (Results, 'Sp = ', (8*(H-1) + W) /H);
WriteLn (Results);
WriteLn (Results, 'Ep = ', (8*(H-1) + W) / H / 8);
WriteLn (Results); WriteLn (Results, 'h = ', H);

WriteLn (Results);
WriteLn (Results, 'Z = ', (8*(H-1) + W) / (8*H) *100,'%');
{Zakryt faily}
Close(MatrC);
Close(MatrB);
Close(MatrA);
Close(Results); end.
 Оффлайн  Профиль  PM 
 К началу страницы 
+ Ответить 

Сообщений в этой теме


 Ответить  Открыть новую тему 
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 





- Текстовая версия 19.04.2024 11:02
500Gb HDD, 6Gb RAM, 2 Cores, 7 EUR в месяц — такие хостинги правда бывают
Связь с администрацией: bu_gen в домене octagram.name