Mihai Sprinceana
Un forum de programare cu de toate. Va astept sa va inscrieti si sa deveniti moderatori. Oricine este binevenit aici sa se inscrie si sa aiba acces la informatie free! Fiecare este liber sa adauge proiecte programe free etc. Ajutati acest forum sa devina o comunitate puternica unde fiecare invata de la fiecare! Tot ce trebuie sa faceti este sa va inregistrati si fiecare contributie se poate dovedi utila in timp! Forumul este free informatia free dk aveti timp liber ajutati si pe ceilalti si invatati si voi in acelasi timp! Haideti sa facem ceva pt.a ne ajuta intre noi! Cititi regulament postare forum inainte de a posta!
Lista Forumurilor Pe Tematici
Mihai Sprinceana | Inregistrare | Login

POZE MIHAI SPRINCEANA

Nu sunteti logat.
Nou pe simpatie:
crazylife
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 47 ani
Mihai Sprinceana / Pascal / Matrice-Probleme deosebite cu matrici Moderat de Houssey, cosmin, cosmy, fireratbat, profu.info, sade5000
Autor
Mesaj Pagini: 1
mihaispr
Administrator

Inregistrat: acum 17 ani
Postari: 2142
{PR.19M/213 Creati un program care afiseaza elementele unei
matrice patratice de dimensiune n, dupa stergerea elementelor
situate pe diagonala principala.
Ex:
Pt.n=4 si matricea:
0 1 1 2
3 3 4 5
6 7 8 9
7 8 9 5
se va afisa:
1 1 2
3 4 5
6 7 9
7 8 9}
var a:array[1..50,1..50] of integer;
    b:array[1..50] of integer;
    i,j,n:integer;
begin
write('n=');readln(n);
for i:=1 to n do
for j:=1 to n do
              begin
              write('a[',i,',',j,']=');
              readln(a[i,j]);
              end;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j],' ');
writeln;
end;
writeln;
        for i:=1 to n do
        begin
        for j:=i+1 to n do
        a[i,j-1]:=a[i,j];
        end;
for i:=1 to n do
begin
for j:=2 to n do
write(a[i,j-1],' ');
writeln;
end;
readln
end.


var f,g:text;
    a:array[1..50,1..50] of integer;
    m,n,i,j:integer;
begin
assign(f,'input.txt');
assign(g,'ouput.txt');
reset(f);
rewrite(g);
read(f,n);
for i:=1 to n do
    for j:=1 to n do read(f,a[i,j]);
for i:=1 to n-1 do
    for j:=i+1 to n do
        a[i,j-1]:=a[i,j];
for i:=1 to n do
    begin
    for j:=1 to n-1 do
        write(g,a[i,j],' ');
    writeln;
    end;
close(f);
close(g);
end.


{PR.17M/213 Intr-o matrice de dimensiune n*n,cele doua diagonale
creeaza 4 zone:
* 1 1 1 *
4 * 1 * 2
4 4 * 2 2
4 * 3 * 2
* 3 3 3 *
Creati un program care determina elementul minim si maxim al
fiecarei zone}
var a:array[1..50,1..50] of integer;
    b,c:array[1..50] of integer;
    i,j,n,max,min:integer;
begin
write('n=');readln(n);
for i:=1 to n do
for j:=1 to n do
              begin
              write('a[',i,',',j,']=');
              readln(a[i,j]);
              end;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j],' ');
writeln;
end;
writeln;
for i:=1 to n do
for j:=1 to n do
    begin
          if (j>i) and (i+j<n+1) then
          b[i]:=a[i,j];
    end;
max:=b[i];
for i:=2 to n do
    if b[i]>max then max:=b[i];
    writeln('max=',max);
writeln;
readln
end.


type mat=array[1..20,1..30] of integer;
var a:mat;
    v:array[1..100] of integer;
    i,m,n,j,k,aux,l:integer;
begin
write('n=');readln(n);
write('m=');readln(m);
for i:=1 to n do
for j:=1 to m do
  begin
  write('a[',i,',',j,']=');readln(a[i,j]);
  end;
writeln('matricea initiala:');
for i:=1 to n do
begin
for j:=1 to m do write(a[i,j]:4);
writeln
end;

{se transforma vectorul in matrice}
k:=0;
for i:=1 to n  do
for j:=1 to m do
   begin
   inc(k);
   v[k]:=a[i,j];
   end;
{se ordoneaza crescator vectorul}
for i:=1 to k-1 do
for j:=i+1 to k do
  if v[i]>v[j] then
    begin
    aux:=v[i];
    v[i]:=v[j];
    v[j]:=aux;
    end;
{se transforma vectorul in matrice}
l:=0;
for i:=1 to n do
for j:=1 to m do
   begin
     inc(l);
     a[i,j]:=v[l];
     end;

writeln('matricea dupa ordonare');
for i:=1 to n do
begin
for j:= 1 to m do
write(a[i,j]:4);writeln;
end;
readln
end.


var f,g:text;
    a:array[1..40,1..50] of integer;
    v:array[1..100] of integer;
    n,m,i,j,k,l,aux:integer;
begin
assign(f,'in.txt');
assign(g,'out.txt');
reset(f);
rewrite(g);
read(f,m);
read(f,n);
for i:=1 to m do
    for j:=1 to n do
        read(f,a[i,j]);
k:=0;
for i:=1 to n  do
for j:=1 to m do
   begin
   inc(k);
   v[k]:=a[i,j];
   end;
for i:=1 to k-1 do
for j:=i+1 to k do
  if v[i]>v[j] then
    begin
    aux:=v[i];
    v[i]:=v[j];
    v[j]:=aux;
    end;
l:=0;
for i:=1 to n do
for j:=1 to m do
   begin
     inc(l);
     a[i,j]:=v[l];
     end;
for i:=1 to m do
    begin
    for j:=1 to n do write(g,a[i,j],' ');
    writeln;
    end.

{PR.16M/213 Sa se rearanjeze elementele unei matrice de dimensiune
n*m, astfel incat ele sa fie ordonate crescator atat pe linii
cat si pe coloane
Ex:n=3,m=4 si matricea
3 1 8 9
4 6 5 7
2 0 1 3
se va afisa:
0 1 1 2
3 3 4 5
6 7 8 9}

var a:array[1..50,1..50] of integer;
    b:array[1..50] of integer;
    i,j,k,k1,m,n,q,aux:integer;
begin

     write('n=');readln(n);
     write('m=');readln(m);
     for i:=1 to n do
     for j:=1 to m do
            begin
              write('a[',i,',',j,']=');
              readln(a[i,j]);
            end;
     for i:=1 to n do
     begin
     for j:=1 to m do
     write(a[i,j],' ');
     writeln;
     end;
writeln;
k:=0;
     for i:=1 to n do
     for j:=1 to m do;
         begin
         k:=k+1;
         b[k]:=a[i,j];
         end;
         for k:=1 to n*(m-1) do
             for k1:=k+1 to n*m do
                 if b[k]>b[k1] then
                    begin
                    aux:=b[k];
                    b[k]:=b[k+1];
                    b[k1]:=aux;
                    end;
     for k1:=1 to n*m do
         write(b[k1],' ');
         writeln;
q:=0;
for i:=1 to n do
for j:=1 to m do
begin
q:=q+1;
a[i,j]:=b[q];
end;
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j]:4);
writeln;
end;
writeln;
readln
end.


var f,g:text;
    a:array[1..40,1..50] of char;
    b:array[1..100] of char;
    m,n,i,j,k:integer;
begin
assign(f,'in.txt');
assign(g,'out.txt');
reset(f);
rewrite(g);
read(f,m);
read(f,n);
for i:=1 to m*n do read(f,b[i]);
k:=0;
for i:=1 to m do
    for j:=1 to n do
        begin
        k:=k+1;
        a[i,j]:=b[k];
        end;
for i:=1 to m do
    begin
    for j:=1 to n do write(g,a[i,j],' ');
    writeln;
    end;
close(f);
close(g);
end.



var f,g:text;
    a:array[1..50,1..50] of integer;
    i,j,n:integer;
begin
assign(f,'in1.txt');
assign(g,'out1.txt');
reset(f);
rewrite(g);
read(f,n);
for i:=1 to n do
   for j:=1 to n do
       if j+i=n+1 then a[i,j]:=0
                  else if i+j<n+1 then a[i,j]:=1
                                  else a[i,j]:=2;
for i:=1 to n do
    begin
    for j:=1 to n do  write(g,a[i,j],' ');
    writeln;
    end;
close(f);
close(g);
end.


var f,g:text;
    a:array[1..40,1..50] of integer;
    n,m,i,j,j1,j2,aux:integer;
begin
assign(f,'in.txt');
assign(g,'out.txt');
reset(f);
rewrite(g);
read(f,m);
read(f,n);
for i:=1 to m do
    for j:=1 to n do
        read(f,a[i,j]);
for i:=1 to m do
    for j1:=1 to n-1 do
        for j2:=j1+1 to n do
            if a[i,j1]>a[i,j2] then
               begin
               aux:=a[i,j1];
               a[i,j1]:=a[i,j2];
               a[i,j2]:=aux;
               end;
for i:=1 to m do
    begin
    for j:=1 to n do write(g,a[i,j],' ');
    writeln;
    end;
close(f);
close(g);
end.

type mat=array[1..30,1..20]of string[20];
var a:mat;
    n,m,i,j,max,p:integer;
begin
write('n=');readln(n);
write('m=');readln(m);
for i:=1 to n do
for j:=1 to m do
begin
  write('a[',i,',',j,']=');
  readln(a[i,j]);
end;
for i:=1 to n do
begin
for j:=1 to m do write(a[i,j]:15);
writeln;
end;
for i:=1 to n do
    begin
    max:=length(a[i,1]);
    p:=1;
    for j:=2 to m do
      if length(a[i,j])>max then
                          begin
                          max:=length(a[i,j]);
                          p:=j;
                          end;
    writeln('cuvantul de lungime maxima pe linia ',i,' este:',a[i,p]);
    end;
readln
end.


pus acum 16 ani
   
Pagini: 1  

Mergi la