program main implicit none integer::a,m,i,j,bits read *,m do i=1,m read *, a a = a + 1 bits=BIT_SIZE(a) - LEADZ(a) - 2 do j=bits,0,-1 if(BTEST(a, j)) then write(*,'(a)',advance='no'),'R' else write(*,'(a)',advance='no'),'L' end if end do print *, end do end program main