luogu#P5083. 函数
函数
Problem Description
Xiaoben has a binary function .
If or , it returns .
Otherwise, it returns the maximum of the following four expressions (all divisions are integer divisions):
$$g(b/2)+g(b/3)+g(b/8)+g(b/9)+g(a/2)+g(a/3)+g(a/8)+g(a/9)$$Here, returns , and it returns when .
Of course, even an idiot can figure out that you can use memoization to compute smaller values of , so Xiaoben will not test you with such an easy problem.
He wants you to find the value of when both and are less than .
Input Format
The input contains multiple test cases.
Each test case consists of one line with two positive integers .
Output Format
For each test case, output one line containing the value of .
5 6
1 1
1 223
11
2
224
Hint
For of the testdata, .
For of the testdata, the time limit is seconds.
For of the testdata, . The number of test cases does not exceed .
Translated by ChatGPT 5