当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4692:Great Sequence

题目描述
A great sequence S is a sequence contains N decimal integers, i.e. S = (x[1], x[2], ..., x[N]). S should also satisfy following rules:
a[i] ≤ x[i] ≤ b[i]
ds[i] c[i] ds[i+1], where ds[i] is the digit sum of x[i] and c[i] is one of the following relational operators: "=", "<", "<=", ">", ">=" and "!=".
Obviously, there are a lot of great sequences. You are asked to find the K-th least great sequence in lexicographic order.
输入解释
There are multiple test cases. Process to the End of File.
The first line of each test case contains two integers 1 ≤ N ≤ 100, 1 ≤ K ≤ 1016, as described above.
In the next N-1 lines, each line contains three elements, a[i], b[i] and c[i], where a[i] and b[i] are integers (1 ≤ a[i] ≤ b[i] ≤ 1018) while c[i] is one of the following strings: "=", "<", "<=", ">", ">=" and "!=".
The last line of each test cases contains only two integers, a[N] and b[N] (1 ≤ a[N] ≤ b[N] ≤ 1018).
输出解释
For each test case, if the total number of great sequences is less than K, output "OUT OF RANGE" (without quotes); otherwise, output the K-th least great sequence in one line. Numbers in the sequence are separated by a single space.
输入样例
3 15
9 10 <=
99 100 =
1 300
3 20
9 10 <=
99 100 =
1 300
输出样例
10 100 100
OUT OF RANGE
来自杭电HDUOJ的附加信息
Author Zejun Wu (watashi)
Recommend zhuyuanchen520

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4692

最后修改于 2020-10-25T23:15:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/10000MS(Java/Others) 131072/131072K(Java/Others)