Huawei OD Computer Test Real Questions-Mars Computing-2023 OD Unified Examination (Paper C)

Topic description:

It is known that the operators used by Martians are # and $, and their equivalent formulas to those on Earth are as follows: 
x#y = 4*x+3*y+2  
x$y = 2*x+y+3  
1. Where x and y are unsigned integers 
2. Earthling formulas are calculated according to C language rules 
3. In Martian formulas, # has a higher priority than $, and the same operators are calculated from left to right < a i=6> There is a string message from Martians. Please translate it and calculate the result.

 

Enter description:

Martian string expression (without carriage return and line feed at the end)

Description of the input string: The string is a calculation expression consisting only of unsigned integers and operators (#, $). For example: 123#4$5#67$78.​  

1. The use case ensures that there is no separator between the operand and operator in the string.  
2. The use case ensures that the operand value range is a 32-bit unsigned integer.  
3. Ensure that the input and calculation results will not cause integer overflow.  
4. Ensure that the input string is a legal evaluation message, for example: 123#4$5#67$78  
5. Ensure that there will be no illegal Evaluation message, for example, a string like this:  
#4$5 //Operation missing  
4$5# //Operation missing  < a i=7> 4#$5 //Operation missing 4 $5 //There are spaces   3+4-5*6/7 //Other operations Symbol   12345678987654321$54321 //32-bit integer calculation overflow



Output description:

Output the calculation result based on the input Martian string (without carriage return and line feed at the end)

Example 1

enter:

7#

Supongo que te gusta

Origin blog.csdn.net/2301_76848549/article/details/135011431
Recomendado
Clasificación