program main integer::N integer::A(4),B(4) integer::AA(4,24),BB(4,24) integer::AAA(24) integer::i,j,k,l,indx = 0,total=0,pat=1 read *,N read *,A(1:N), B(1:N) do i=1,N if(N.eq.1) then indx = indx + 1 AA(1,indx) = A(i) BB(1,indx) = B(i) cycle end if do j=1,N if(i.eq.j) cycle if(N.eq.2) then indx = indx + 1 AA(1:2,indx) = (/A(i),A(j)/) BB(1:2,indx) = (/B(i),B(j)/) cycle end if do k=1,N if(i.eq.k) cycle if(j.eq.k) cycle if(N.eq.3) then indx = indx + 1 AA(1:3,indx) = (/A(i),A(j),A(k)/) BB(1:3,indx) = (/B(i),B(j),B(k)/) cycle end if do l=1,N if(i.eq.l) cycle if(j.eq.l) cycle if(k.eq.l) cycle indx = indx + 1 AA(1:4,indx) = (/A(i),A(j),A(k),A(l)/) BB(1:4,indx) = (/B(i),B(j),B(k),B(l)/) end do end do end do end do do i=2,N pat=pat*i end do do i=1,pat do j=1,pat AAA(j) = 0 do k=1,N if ( AA(k,i).gt.BB(k,j) ) then AAA(j) = AAA(j) + 1 else if ( AA(k,i).lt.BB(k,j) ) then AAA(j) = AAA(j) - 1 end if end do end do total = total + COUNT(AAA(1:pat).gt.0) end do print '(a,f0.2)', '0',REAL(total)/REAL(pat*pat) end program main