Cod sursa(job #2499017)

Utilizator Teo_1101Mititelu Teodor Teo_1101 Data 25 noiembrie 2019 09:38:33
Problema Stergeri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.77 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("stergeri.in");
ofstream fout("stergeri.out");

int N, M, K;

void Solve()
                            {
    int x, y                ;
    if( M )
                            {
        fin >> x >> y       ;
        M--                 ;
        Solve()             ;
                            }
    if( x <= K )
        K += y - x + 1      ;
                            }
void Read()
                            {
    fin >> N >> M >> K      ;
    int x, y                ;

    Solve();

    fout << K << '\n'       ;
                            }
int main()
                            {
    Read()                  ;
    return 0                ;
                            }