Untitled
unknown
plain_text
a year ago
417 B
8
Indexable
#include <bits/stdc++.h>
using namespace std;
long long a[1000],b[1000];
int main()
{
int m;
cin >> m;
for (int f=0; f<m; f++)
{
cin >> a[f];
cin >> b[f];
}
long long sum=a[0]+b[0];
for (int f=1; f<m; f++)
{
if (sum<=a[f])
{
sum=a[f]+b[f];
}
else sum+=b[f];
}
cout << sum;
return 0;
}
Editor is loading...
Leave a Comment