辛运数字段
时间限制:1秒 内存限制:256M
【题目描述】
如果一个十进制数仅含数字 4 和 7,那么称它为幸运数。
现在给你 \(n\) 个整数区间,一次操作可以将其中一个区间的左右端点均右移或左移 1。求在操作次数不超过k次的情况下,所有区间的交中最多包含多少个幸运的数。
【输入格式】
第一行包含两个整数 \(n\) 和 \(k\)。
接下来的 \(n\) 行,每行表示一个区间 \(l_i,r_i\),表示区间的左右段点。
【输出格式】
输出一个整数,表示答案。
【输入输出样例1】
Input
4 7
1 4
6 9
4 7
3 5
Output
1
【输入输出样例2】
Input
2 7
40 45
47 74
Output
2
【样例解释】
In the first sample Petya shifts the second segment by two units to the left (it turns into [4; 7]), after that number 4 becomes full.
In the second sample Petya shifts the first segment by two units to the right (it turns into [42; 47]), and shifts the second segment by three units to the left (it turns into [44; 71]), after that numbers 44 and 47 become full.
【数据限制】
\(100\%\) 的数据满足:\(n≤10^5\),\(k≤10^{18}\),\(1≤l_i≤r_i≤10^{13}\)
【来源】
Mr.he