Pagini recente » "Adolescent Grigore Moisil" International Programming Contest | arbore5 | Diferente pentru problema/difprim intre reviziile 5 si 12 | Diferente pentru problema/alianta intre reviziile 3 si 4 | Diferente pentru problema/occurences intre reviziile 1 si 2
Nu exista diferente intre titluri.
Diferente intre continut:
== include(page="template/taskheader" task_id="occurences") ==
Poveste şi cerinţă...
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$?
h2. Date de intrare
Fişierul de intrare $occurences.in$ ...
The first line of the file $occurences.in$ will contain $t$, the number of test cases ($1 \le t \le 10^5$).
Each of the next $t$ lines will contain a single number $n$, ($1 \le n \le 10^{18}$).
For tests worth $50$ points, ($1 \le n \le 1000$).
h2. Date de ieşire
În fişierul de ieşire $occurences.out$ ...
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.
h2. Restricţii
h2. Exemplu
table(example). |_. occurences.in |_. occurences.out |
| This is some
text written on
multiple lines.
| This is another
text written on
multiple lines.
| 3
2
18
1
| 2
4
1
|
h3. 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$.
== include(page="template/taskfooter" task_id="occurences") ==
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.