Pagini recente » Cod sursa (job #57140) | Cod sursa (job #290807) | Cod sursa (job #59754) | Cod sursa (job #2311026) | Cod sursa (job #557377)
Cod sursa(job #557377)
#include <fstream>
using namespace std;
#define maxC 100005
#define LL long long
struct cut
{
LL low, high;
};
LL N, M, K, sol;
cut x[maxC];
int main()
{
ifstream f("stergeri.in");
ofstream g("stergeri.out");
f >> N >> M >> K;
sol = K;
for (LL i = M; i >= 1; -- i)
{
f >> x[i].low;
f >> x[i].high;
}
for (LL i = 1; i <= M; ++ i)
if ( sol > x[i].low )
{
sol += x[i].high - x[i].low;
++ sol;
}
g << sol;
return 0;
}