luogu#P5238. 整数校验器
整数校验器
Problem Description
Sometimes you need to solve this kind of problem: determine whether a number is valid.
is valid if and only if it satisfies the following conditions:
- The format of is valid. A valid integer is either , or is formed by concatenating, in order, an optional minus sign, a digit from to , and then some digits from to .
- is within the interval (i.e., ).
You need to implement such a validator. Given and , you will check multiple times whether each is valid.
Input Format
The first line contains three integers , indicating that the validator checks the interval , and there are values of to be checked.
The next lines each contain one , the number to be checked. It is guaranteed that the length of is at least and it consists only of '0'~'9' and '-', and '-' appears only as the first character.
Output Format
Output lines in total, each containing one integer representing the validation result for each .
The results are defined as follows: means is valid; means the format of is invalid; means the format of is valid but is not within the interval .
-3 3 4
0
00
-0
100000000000000000000
0
1
1
2
Hint
For of the testdata, , and are within the range of 64-bit signed integers (i.e., ).
The input file size is guaranteed to be no more than . The testdata is generated under Linux, and there is no '\r' character.
Below are some special constraints (they do not include each other):
- For of the testdata, .
- For of the testdata, it is guaranteed that the format of is always valid.
- For of the testdata, it is guaranteed that if the format of is valid, then is within the range of 64-bit signed integers.
There is an unscored hack test point, intended to test the handling of long long boundary values. If you get UnAC with 100 points, it may be because you did not consider this case.
Translated by ChatGPT 5