#P16311. [ICPC 2023 Jinan R] 最大数码
[ICPC 2023 Jinan R] 最大数码
Problem Description
Let be the largest digit in the decimal representation of a positive integer . For example, and .
Given four positive integers , , , and satisfying and , compute the maximum possible value of , where and .
Input Format
There are multiple testdata. The first line contains an integer (), denoting the number of test cases. For each test case:
The first line contains four integers , , , and (, ).
Output Format
For each test case, output one integer per line, representing the maximum value of .
2
178 182 83 85
2 5 3 6
7
9
Hint
For the first sample testdata, the answer is .
For the second sample testdata, the answer is .
Translated by ChatGPT 5