knightnemo commited on
Commit
60aceac
·
verified ·
1 Parent(s): a5a3316

Upload code_segments/segment_204.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_204.txt +15 -0
code_segments/segment_204.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ On the board Ivy wrote down all integers from $l$ to $r$, inclusive.
2
+
3
+ In an operation, she does the following:
4
+
5
+ * pick two numbers $x$ and $y$ on the board, erase them, and in their place write the numbers $3x$ and $\lfloor \frac{y}{3} \rfloor$. (Here $\lfloor \bullet \rfloor$ denotes rounding down to the nearest integer).
6
+
7
+ What is the minimum number of operations Ivy needs to make all numbers on the board equal $0$? We have a proof that this is always possible.
8
+
9
+ The first line contains an integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.
10
+
11
+ The only line of each test case contains two integers $l$ and $r$ ($1 \leq l < r \leq 2 \cdot 10^5$).
12
+
13
+ For each test case, output a single integer — the minimum number of operations needed to make all numbers on the board equal $0$.
14
+
15
+ In the first test case, we can perform $5$ operations as follows: $$ 1,2,3 \xrightarrow[x=1,\,y=2]{} 3,0,3 \xrightarrow[x=0,\,y=3]{} 1,0,3 \xrightarrow[x=0,\,y=3]{} 1,0,1 \xrightarrow[x=0,\,y=1]{} 0,0,1 \xrightarrow[x=0,\,y=1]{} 0,0,0 .$$