Cod sursa(job #1190753)
Utilizator | Data | 25 mai 2014 17:12:58 | |
---|---|---|---|
Problema | Stergeri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Teme Pregatire ACM Unibuc 2013 Semestrul 2 | Marime | 0.39 kb |
#include<fstream>
using namespace std;
ifstream fi("stergeri.in");
ofstream fo("stergeri.out");
int n,m,k;
void calcul(int m){
int x,y;
if(m){
fi>>x>>y;
calcul(m-1);
if(x<=k) k+=(y-x+1);
}
}
int main(){
fi>>n>>m>>k;
calcul(m);
fo<<k;
fi.close();
fo.close();
return 0;
}