Pessoal eu estava fazendo um problema de uma questão que envolve uma formula assim: 3n+1.
Quando eu coloco um numero para fazer ele roda perfeito.
Mas o problema pede para fazer com dois numeros… Só que tem um detalhe! Eu não entendi muito bem o que o problema pede… vc´s tem como dar ajuda pra entender este problema. Mas não resolver.
O maior problema ficou nesta parte…
For any two numbers i and j you are to determine the maximum cycle length over all numbers between i and j.
The Input
The input will consist of a series of pairs of integers i and j, one pair of integers per line. All integers will be less than 1,000,000 and greater than 0.
You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.
You can assume that no operation overflows a 32-bit integer.
The Output
For each pair of input integers i and j you should output i, j, and the maximum cycle length for integers between and including i and j. These three numbers should be separated by at least one space with all three numbers on one line and with one line of output for each line of input. The integers i and j must appear in the output in the same order in which they appeared in the input and should be followed by the maximum cycle length (on the same line).
na minha tradução arranhada é pegar dois numeros e fazer no algoritmo que envolve o 3n+1.
segue o end do problema.
http://acm.uva.es/p/v1/100.html
grato.
Eu ja tenho o algoritmo implementado para um numero n qualquer. tipo 22 da 16…