Revizia anterioară Revizia următoare
Fişierul intrare/ieşire: | occurences.in, occurences.out | Sursă | IIOT 2021-22 Runda 2 |
Autor | Vlad Andries | Adăugată de | |
Timp execuţie pe test | 0.25 sec | Limită de memorie | 32768 kbytes |
Scorul tău | N/A | Dificultate | N/A |
Vezi solutiile trimise | Statistici
Maximum 0ccurrences
You are given an integer n and you have to do one operation at a time:
1. If n is odd, you must multiple it by 3 and add 1 to the result.
2. If n is even, you must divide it by 2.
What is the number with maximum occurrences if you do 10^100 operations on the given number n?
Date de intrare
The first line of the file occurences.in will contain t, the number of test cases.
Each of the next t lines will contain a single number n, .
Date de ieşire
On each line of the output file occurences.out we will print an integer, representing the answer to the problem. If there are multiple solutions, print the biggest one of them.
Restricţii
- 1 ≤ n ≤ 10^18
- 1 ≤ t ≤ 10^5
- For tests worth 50 points, 1 ≤ n ≤ 1000.
Exemplu
occurences.in | occurences.out |
---|---|
3 2 18 1 | 2 4 1 |
Explicaţie
For the first sample test case, the numbers printed will be 2, 1, 4, 2, 1, ..., and therefore 2 and 1 will show up one more time than the other numbers. Since we need to print the biggest integer, then we will print 2.