Pagini recente » Cod sursa (job #3282492) | Cod sursa (job #398147) | Cod sursa (job #1194833) | Cod sursa (job #832758) | Cod sursa (job #1732355)
#include <bits/stdc++.h>
using namespace std;
const int nmax = 100005;
struct el{
int x,y;
}a[nmax];
int N,M,K;
int main(){
ifstream f("stergeri.in");
ofstream g("stergeri.out");
int i;
f >> N >> M >> K;
for(i = 1; i <= M; ++i)
f >> a[i].x >> a[i].y;
f.close();
for(i = M; i; --i){
if(K < a[i].x)continue;
K+=(a[i].y-a[i].x+1);
}
g << K << '\n';
g.close();
return 0;
}