Cod sursa(job #3184163)
Utilizator | Lefter Sergiu Sergetec | Data | 14 decembrie 2023 17:23:01 |
---|---|---|---|
Problema | Orase | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
/*
* Lefter Sergiu - 14/12/2023
*/
#include <fstream>
using namespace std;
ifstream in("orase.in");
ofstream out("orase.out");
const int INF = 2e9;
int main() {
int n, m, sc, smax = -INF;
in >> n >> m;
sc = n;
for (int i = 1; i <= m; ++i) {
int x, y;
in >> x >> y;
sc += x + y;
if (sc > smax) {
smax = sc;
}
sc = n;
}
out << smax;
in.close();
out.close();
return 0;
}