5
5
5oCent2022-02-27 00:04:44
Algorithms
5oCent, 2022-02-27 00:04:44

What is the algorithm for finding goods on the rack?

There is a rack
with 10 tiers of 8 cells and 15 places in each cell
The user enters the item number and it is necessary to determine on which tier and in which cell the goods are located

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hint000, 2022-02-27
@5oCent

10 tiers of 8 cells and 15 places in each cell
:
do with division i.e. with div and mod

levels = 10
cells = 8
places = 15
L = X div ( places * cells )
C = ( X div places ) mod cells
P = X mod places
here numbering from zero, as is customary for programmers; if you need numbering from one (like mathematicians), then add one to P, to C and to L.

A
Anton Shamanov, 2022-02-27
@SilenceOfWinter

you store in an array/table a list of products and their position on the rack (well, or a matrix of rack positions with product id as values) what's the problem then?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question