• задана квадратичная матрица А порядка N состоящая из действительных элементов.Найти сумму элементов строки,в которой расположен наибольший элемент.

Ответы 2

  • var a:array [1..100,1..100] of real;i,j,maxi,n:integer;s,max:real;Begin    read(n);    for i := 1 to n do        for j := 1 to n do begin            read(a[i,j]);            if ((i=1) and (j=1)) or (max<a[i,j]) then begin                max:=a[i,j];                maxi:=i;            end;        end;    for j := 1 to n do        s:=s+a[maxi,j];    writeln(s);End.

  • #include <iostream>

    using namespace std;

    int main(){ int N; cin >> N; float** A; A = (float**) malloc(N * sizeof(float*)); for(int i = 0; i < N; i++) A[i] = (float*)malloc(N * sizeof(float)); for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) cin >> A[i][j]; int I1; int max = A[0][0]; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { if(A[i][j]>max) { max = A[i][j]; I1 = i; } } } int sum = 0; for(int i = 0;i<N;i++) sum+=A[I1][i]; cout<<sum<<endl; system("PAUSE"); return 0;}

  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years