|
|
back to boardWA #32 Who can give me test 32? Please! program ex; type z=array [1..4002] of longint; var n,n1,n2,i,t,k,s,j,l:longint; a,a1,a2,r:z; begin readln(n); for i:=1 to n do read(a[i]); readln(n1); for i:=1 to n1 do read(a1[i]); readln(n2); for i:=1 to n2 do read(a2[i]); j:=1; i:=1; k:=0; repeat if a1[j]>a[i] then i:=i+1; if a1[j]<a[i] then j:=j+1; if a1[j]=a[i] then begin k:=k+1; r[k]:=a1[j]; j:=j+1; end; until (i>=n) or (j>=n2) ; i:=1; j:=1; s:=0; repeat if r[j]>a2[i] then i:=i+1; if r[j]<a2[i] then j:=j+1; if r[j]=a2[i] then begin s:=s+1; j:=j+1; end; until (i>=n2) or (j>=k) ; write(s); end. |
|
|