blob: a594f21561ccfcd313c1048655b404092dfb42d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
program Ch1;
{$mode objfpc}
uses
SysUtils,Types;
var
Arr,Arr2:TIntegerDynArray;
function SumBitwiseOperator(Arr:TIntegerDynArray):Integer;
var
I,J:Integer;
begin
Result := 0;
for I := 0 to High(Arr) do
for J := I+1 to High(Arr) do
Result := Result + Arr[I] and Arr[J];
end;
begin
Arr := TIntegerDynArray.Create(1,2,3);
Arr2 := TIntegerDynArray.Create(2,3,4);
WriteLn(SumBitwiseOperator(Arr));
WriteLn(SumBitwiseOperator(Arr2));
end.
|