implicit none integer::N,i,j integer,allocatable::L(:,:) integer::total(6),max,indx data total/6*0/ read *,N allocate(L(N,0:6)) read *,L(:,0) do i=1,N L(i,6) = L(i,0)/6 L(i,5) = L(i,0)/5 L(i,4) = L(i,0)/4 L(i,3) = L(i,0)/3 L(i,2) = L(i,0)/2 L(i,1) = L(i,0) end do total(6) = SUM(L(:,6)) total(5) = SUM(L(:,5))-total(6) total(4) = SUM(L(:,4))-total(6)-total(5) total(3) = SUM(L(:,3))-2*total(6)-total(5)-total(4) total(2) = SUM(L(:,2))-3*total(6)-2*total(5)-2*total(4)-total(3) total(1) = N-SUM(total(2:6)) max = MAXVAL(total(1:6)) do i=6,1,-1 if(max.eq.total(i)) then print '(i0)', i return end if end do end program