Pagini recente » Cod sursa (job #1575827) | Cod sursa (job #3277976) | Cod sursa (job #1332975) | Cod sursa (job #943993) | Cod sursa (job #325178)
Cod sursa(job #325178)
#include<stdio.h>
int k,t,x,y,n,m,i;
struct nod
{ int x,y;
}a[100010];
int main()
{
freopen("stergeri.in","r",stdin);
freopen("stergeri.out","w",stdout);
scanf("%d %d %d",&n,&m,&k);
for(i=1;i<=m;i++) scanf("%d %d",&a[i].x,&a[i].y);
for(i=m;i>=1;--i) if (a[i].x<=k) k+=a[i].y-a[i].x+1;
printf("%lld\n",k);
fclose(stdin);
fclose(stdout);
return 0;
}