function TenIn16(x: integer): string; var s: string; begin repeat s := sixteen[x mod 16 + 1] + s; x := x div 16; until x = 0; if length(s) = 1 then s := '0' + s; TenIn16 := s; end;
var f1, f2: text; a1, a2, a3: byte;
begin assign(f1, 'record.txt'); reset(f1); assign(f2, 'result.txt'); rewrite(f2); while not eof(f1) do begin read(f1, a1, a2, a3); writeln(f2, TenIn16(a1), TenIn16(a2), TenIn16(a3)); end; close(f1); close(f2); end.
sixteen: string = '0123456789ABCDEF';
function TenIn16(x: integer): string;
var s: string;
begin
repeat
s := sixteen[x mod 16 + 1] + s;
x := x div 16;
until x = 0;
if length(s) = 1 then s := '0' + s;
TenIn16 := s;
end;
var
f1, f2: text;
a1, a2, a3: byte;
begin
assign(f1, 'record.txt');
reset(f1);
assign(f2, 'result.txt');
rewrite(f2);
while not eof(f1) do
begin
read(f1, a1, a2, a3);
writeln(f2, TenIn16(a1), TenIn16(a2), TenIn16(a3));
end;
close(f1);
close(f2);
end.
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
cout<<endl;
int **ma;
ma=(int **)malloc(sizeof(int*)*n);
for (int i=0;i<n;i++){
ma[i]=(int*)malloc(sizeof(int)*n);}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
cin>>ma[i][j];
cout<<endl;}
for(int i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
if(ma[i][j]!=ma[j][i]){
cout<<"NO";
cin.get();
cin.get();
return 0;}
cout<<"YES";
cin.get();
cin.get();
return 0;
}
Пример ввода:
4
1
2
3
4
2
1
2
3
3
2
1
4
4
3
4
1
Пример вывода:
YES