Time Limit: 10s
Memory Limit: 128MB
Yesterday xiaoY’s teacher HH had given him an interesting problem, and xiaoY got mad about this problem. So he turned to you for help, here is the problem!
HH gave xiaoY a number M and N intervals [xi,yi] which means the integers from xi to yi are all chosen, Now he wanted xiaoY to tell him which number was absent!
(HH ensured that there was just one number absent from 1 to M and any two intervals didn’t overlap)
Multiple cases ended with 2 zeros.
N M (0<N<=10^7, 0<M<=10^8, integer)
N lines followed, each containing two integers:
xi yi (integer)
An integer (the absent number)
3 10 3 5 1 2 7 10 2 5 1 2 4 5 0 0
since there is too much data, scanf is recommended.
If you need to use 64bit integer, the following code may be helpful:
using namespace std;
long long a = 12345678987654321LL;
int b = 88888888, c = 99999999;
cout << a << endl << (long long)b * c << endl;